开发者

select table from other schema

I have a table from sche开发者_JAVA百科ma "test":

class AttributeConversion(Base):
    __tablename__ = 'test.attribute_conversion'

How to select records from this table?

SQLAlchemy generates SQL:

select * from "test.attribute_conversion"

But it doesn't work. The correct query must be:

select * from test.attribute_conversion  (without quotes)


You can explicity specify a schema name for a table:

class AttributeConversion(Base)
    __tablename__ = 'attribute_conversion'
    __table_args__ = {'schema' : 'test'}

See documentation on specifying the schema name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜