Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

How do I specify a catalog if I'm defining mutiple tables using the sqlalchemy ORM style?

未關閉
#446 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
python, sqlalchemy
領域
databases

研究方向

從 issue 中的 Foo 和 Bar 宣告式範例開始,追蹤它們的 schema 名稱和資料表名稱如何傳遞到 connector 的 catalog 設定。確認宣告式對映是否可以攜帶不同的 catalog,並定義查詢完整限定資料表時的預期行為。

由索引模型根據 Issue 內容生成。

描述

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)
主要語言
Python
星號
233
分支
152
平均合併
21 小時 5 分鐘
30 天內合併 PR
10

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

databricks/databricks-sql-python 的其他 Issue

查看 databricks/databricks-sql-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。