summaryrefslogtreecommitdiff
path: root/alembic/templates/pylons
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-07-20 12:54:37 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-07-21 12:07:30 -0400
commit7995199012173d77e2dcaf02d4ded5d2d7a6f634 (patch)
tree40d52590ef9ff7d4e4708318eb0f924f95e7033c /alembic/templates/pylons
parent02a1bf3454acb7b02942e246c19326630a8f9175 (diff)
downloadalembic-7995199012173d77e2dcaf02d4ded5d2d7a6f634.tar.gz
Add dialect_options to environment; set paramstyle=named for offline
Fixed bug where the double-percent logic applied to some dialects such as psycopg2 would be rendered in ``--sql`` mode, by allowing dialect options to be passed through to the dialect used to generate SQL and then providing ``paramstyle="named"`` so that percent signs need not be doubled. For users having this issue, existing env.py scripts need to add ``dialect_opts={"paramstyle": "named"}`` to their offline context.configure(). See the ``alembic/templates/generic/env.py`` template for an example. Change-Id: Ia6a495704b029eaff43fb3b6df602ca667002b7a Fixes: #562
Diffstat (limited to 'alembic/templates/pylons')
-rw-r--r--alembic/templates/pylons/env.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/alembic/templates/pylons/env.py b/alembic/templates/pylons/env.py
index f8abf44..b2d610d 100644
--- a/alembic/templates/pylons/env.py
+++ b/alembic/templates/pylons/env.py
@@ -53,6 +53,7 @@ def run_migrations_offline():
url=meta.engine.url,
target_metadata=target_metadata,
literal_binds=True,
+ dialect_opts={"paramstyle": "named"},
)
with context.begin_transaction():
context.run_migrations()