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.
精彩评论