Cross catalog query support
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start by reviewing the documented connection URL with schema and catalog, then compare it with the table_args and quoted_name examples in the issue. Define what per-table catalog support should mean for cross-schema and cross-catalog queries, and confirm that the resulting table declarations can join the described Delta and LakeBase tables through one engine.
Written by the indexing model from the issue text.
Description
I would like to use databricks-sqlalchemy to query tables located in different schemas and catalogs (or even JOIN them) using the same engine, current documentation presents only a single configuration where both schema and catalog are provided as part of the URL:
databricks://token:{token}@{hostname}?http_path={http_path}&schema={schema}&catalog={catalog}
I discovered (it's not documented) that i can remove both parameters from the URL and use __table_args__ to provide these
for every Table:
class SomeTable(Base):
__tablename__ = "some_table"
__table_args__ = (
{"schema": quoted_name(f"my_catalog.my_schema", quote=False)},
)
some_field = Column(String(6), nullable=False)
It looks like a hack, because the schema property value is actually a catalog + schema, and i need to use quoted_name to avoid some errors.
Would it be possible to support some dialect specific property, for example databricks_catalog to define a catalog as part of the __table_args__? It would look like this:
__table_args__ = (
{"schema": "my_schema", "databricks_catalog": "my_catalog"},
)
Just catalog is not allowed here because it leads to an error:
TypeError: Additional arguments should be named <dialectname>_<argument>, got 'catalog'
But dialect specific should be fine.
Having such feature would be easier for us to use the library with our use case (we want to join Delta tables with LakeBase ones added to Unity Catalog)
Thanks
- Dominant language
- Python
- Stars
- 24
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from databricks/databricks-sqlalchemy
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
databricks/databricks-sqlalchemy#73 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in databricks/databricks-sqlalchemy
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100