- edited description
SQLAlchemy, postgres and schema
Hi, I am trying to work to setup a multi-schema environnement with sqlalchemy and postgres but i am struggling for two reasons :
-
It seems that you cannot change dynamically the schema (i did metadata.schema = 'new_schema' and looped over all tables to also do table.schema = 'new_schema' but it feels like a hack). Does the library have a function to do this properly ?
-
Some object does not inherit the schema option from the table or metadata. An example would be the postgresql enum type. How do you control in which schema the type gets created ?
Comments (6)
-
Account Deactivated reporter -
repo owner With an individual Table you can make a new one with a new schema using tometadata: http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html?highlight=tometadata#sqlalchemy.schema.Table.tometadata
There's also a potential enhancement to provide it at the database connection level with
#2685.enum has its own schema argument: http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#sqlalchemy.types.Enum.params.schema
-
repo owner - changed status to invalid
this is a usage question, not a bug.
-
Account Deactivated reporter Ok great ! Thank you so much for the quick reply and the awesome work on this wonderful library
-
Account Deactivated reporter I am still struggling at doing what i want. If you have time, i would love to have your input in my stackoverflow question (http://stackoverflow.com/questions/25932327/how-to-swap-the-postgres-schema-attribute-for-a-sqlalchemy-metadata)
-
repo owner done
- Log in to comment