From: CaselIT Date: Wed, 11 Jan 2023 20:17:33 +0000 (+0100) Subject: Add commit to cookbook example X-Git-Tag: rel_1_9_2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a304dd12c0242a8e959de6b10272f39052282019;p=thirdparty%2Fsqlalchemy%2Falembic.git Add commit to cookbook example A commit is now required to end the transaction before start executing the migration Fixes: #1150 Change-Id: I704db15155454dafed9d15f768b97f8e2ebfff81 --- diff --git a/docs/build/cookbook.rst b/docs/build/cookbook.rst index 5b12c6b0..8ac5bfc0 100644 --- a/docs/build/cookbook.rst +++ b/docs/build/cookbook.rst @@ -845,6 +845,8 @@ schema or another. # PostgreSQL will emit all CREATE / ALTER / DROP statements # in terms of this schema by default connection.execute(text('set search_path to "%s"' % current_tenant)) + # in SQLAlchemy v2+ the search path change needs to be committed + connection.commit() # make use of non-supported SQLAlchemy attribute to ensure # the dialect reflects tables in terms of the current tenant name