summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-12-23 01:22:54 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-12-23 01:22:54 +0000
commit6cf4db7df37e56b700e363b66ab82f5921d1434b (patch)
treeff08404f209a75e1afcc9c17a0463c8f0c501d76 /lib/sqlalchemy/sql/compiler.py
parent886ddcd12db97984cdb1cc94b9abaee5df4eb6d5 (diff)
downloadsqlalchemy-6cf4db7df37e56b700e363b66ab82f5921d1434b.tar.gz
- Columns can again contain percent signs within their
names. [ticket:1256]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 921d932d2..39e3dbfd7 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -407,11 +407,12 @@ class DefaultCompiler(engine.Compiled):
return bind_name
+ _trunc_re = re.compile(r'%\((\d+ \w+)\)s', re.U)
def _truncated_identifier(self, ident_class, name):
if (ident_class, name) in self.truncated_names:
return self.truncated_names[(ident_class, name)]
-
- anonname = name % self.anon_map
+
+ anonname = self._trunc_re.sub(lambda m: self.anon_map[m.group(1)], name)
if len(anonname) > self.label_length:
counter = self.truncated_names.get(ident_class, 1)