percent sign escaping in literal binds
from sqlalchemy import *
e = create_engine("mysql://scott:tiger@localhost/test", echo=True)
s = select([literal("hi % there")])
compiled = s.compile(
dialect=e.dialect,
compile_kwargs=dict(literal_binds=True)
)
assert e.scalar(str(compiled)) == "hi % there"
related to #4052 as that makes use of literals. in addition, comment support should be consistent about its use of literal binds vs. other ad-hoc systems
Comments (2)
-
reporter -
reporter - changed status to resolved
Apply percent sign escaping to literal binds, comments
Fixed bug in new percent-sign support (e.g.
3740
) where a bound parameter rendered with literal_binds would fail to escape percent-signs for relevant dialects. In addition, ensured new table / column comment support feature also fully makes use of literal-rendered parameters so that this percent sign support takes place with table / column comment DDL as well, allowing percent sign support for the mysql / psycopg2 backends that require escaping of percent signs.Change-Id: Ia4136a300933e9bc6a01a7b9afd5c7b9a3fee4e3 Fixes:
#4054Fixes:#4052→ <<cset 2392ae1900f1>>
- Log in to comment
https://gerrit.sqlalchemy.org/489