On 02/10/2017 12:12 PM, Noel Merket wrote:
I need to login using my username and password to a postgres database, but before doing anything issue a SET ROLE command to change my role from the login role to one that has write access to the schema I'm using. In sqlalchemy there's an option to use a custom database connection function <http://docs.sqlalchemy.org/en/latest/core/engines.html#custom-dbapi-connect-arguments> to gain access to the database, which seems to work well enough for that purpose. How can I get alembic to do the same?
Alembic uses the same create_engine() / engine_from_config() directives as SQLAlchemy, and in fact you have total control over how create_engine() /engine_from_config() is called within the env.py script that's in your Alembic environment. The default env.py uses the engine_from_config() call where you can pass most of the same arguments that create_engine() uses, or you can use create_engine() directly. Modify the script as needed.
-- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com <mailto:sqlalchemy-alembic+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.