diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-13 11:35:42 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-13 11:35:42 -0500 |
commit | c7e5194dabde33e57532563efff71584ef12973e (patch) | |
tree | 65c28c403a41fd6fd3e226fe250fe3a38f6b5f38 /alembic/autogenerate | |
parent | aef7c4c7a4f1dcb5037d77e448e3a81a3bdeb89c (diff) | |
download | alembic-c7e5194dabde33e57532563efff71584ef12973e.tar.gz |
wrap text() around it
Diffstat (limited to 'alembic/autogenerate')
-rw-r--r-- | alembic/autogenerate/render.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alembic/autogenerate/render.py b/alembic/autogenerate/render.py index 610a4d4..10a4554 100644 --- a/alembic/autogenerate/render.py +++ b/alembic/autogenerate/render.py @@ -9,13 +9,13 @@ log = logging.getLogger(__name__) def _render_potential_expr(value, autogen_context): if isinstance(value, sql.ClauseElement): if compat.sqla_08: - return str( + return "text(%r)" % str( value.compile(dialect=autogen_context['dialect'], compile_kwargs={'literal_binds': True})) else: return str(value.compile(dialect=autogen_context['dialect'])) else: - return str(value) + return repr(value) def _add_table(table, autogen_context): text = "%(prefix)screate_table(%(tablename)r,\n%(args)s" % { @@ -63,7 +63,7 @@ def _add_index(index, autogen_context): 'unique': index.unique or False, 'schema': (", schema='%s'" % index.table.schema) if index.table.schema else '', 'kwargs': (', '+', '.join( - ["%s=%r" % (key, _render_potential_expr(val, autogen_context)) + ["%s=%s" % (key, _render_potential_expr(val, autogen_context)) for key, val in index.kwargs.items()]))\ if len(index.kwargs) else '' } |