Reputation: 7573
I'm creating SQLAlchemy objects for MSSQL via sub-classing declarative_base(). When shifting from in-memory sqlite to production on MSSQL a try and specify the correct MS 'schema' with:
create_engine(config.DB, schema_name='myschema', echo=False)
however the sql emitted is does not include this schema in the query. Am i doing something wrong? All is working great with sqlite in-memory.
Upvotes: 1
Views: 666
Reputation: 7573
answered by ThiefMaster on freenode #sqlalchemy
if you set the schema directly on the object then it works:
__table_args__ = {'schema': 'myschema'}
Upvotes: 1