diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-17 08:52:55 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-17 08:52:55 -0400 |
commit | c76fd4bbf13a51c41429b7e14cba387d36536006 (patch) | |
tree | 815e5070b25cb4b7a8239203e2b9f5069f06dc59 /docs | |
parent | af3f6d75764b87e1021aecde0019fd5f986946ae (diff) | |
download | alembic-c76fd4bbf13a51c41429b7e14cba387d36536006.tar.gz |
fix search path indicator
Change-Id: I341a57f0bbf7c237c86cb8de4c94a37d737c3c85
Fixes: #1096
Diffstat (limited to 'docs')
-rw-r--r-- | docs/build/cookbook.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/build/cookbook.rst b/docs/build/cookbook.rst index e2b9233..1dc4d79 100644 --- a/docs/build/cookbook.rst +++ b/docs/build/cookbook.rst @@ -829,6 +829,8 @@ schema or another. In ``env.py`` an approach like the following allows ``-xtenant=some_schema`` to be supported by making use of :meth:`.EnvironmentContext.get_x_argument`:: + from sqlalchemy import text + def run_migrations_online(): connectable = engine_from_config( config.get_section(config.config_ini_section), @@ -842,7 +844,7 @@ schema or another. # set search path on the connection, which ensures that # PostgreSQL will emit all CREATE / ALTER / DROP statements # in terms of this schema by default - connection.execute("set search_path to %s" % current_tenant) + connection.execute(text('set search_path to "%s"' % current_tenant)) # make use of non-supported SQLAlchemy attribute to ensure # the dialect reflects tables in terms of the current tenant name |