How do I specify a catalog if I'm defining mutiple tables using the sqlalchemy ORM style?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the Foo and Bar declarative examples in the issue and trace how their schema and table names reach the connector's catalog setting. Confirm whether declarative mappings can carry distinct catalogs and define the expected behavior for querying both fully qualified tables.
Written by the indexing model from the issue text.
Description
I have two tables I want to query from, the fully qualified names are foo_catalog.foo_schema.foo and bar_catalog.bar_schema.bar. I can specify a schema and a tablename in the table definition but I only get a chance to specify the catalog once in the connection.
How do I specify a catalog using declarative base style?
If I was writing raw sql I could query accross both catalogs no problem.
class Base(declarative_base(metaclass=DeclarativeABCMeta)):
__abstract__ = True
class Foo(Base):
__tablename__ = "foo"
__table_args__ = { "schema": "foo_schema"}
id: Mapped[int] = mapped_column(name="id", type_=INTEGER, primary_key=True)
class Bar(Base):
__tablename__ = "bar"
__table_args__ = { "schema": "bar_schema"}
id: Mapped[int] = mapped_column(name="id", type_=INTEGER, primary_key=True)
- Dominant language
- Python
- Stars
- 233
- Forks
- 152
- Avg merge
- 21h 5m
- Merged PRs (30d)
- 10
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-sql-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100