reflected unicode column names used as keyword args

Issue #739 resolved
Former user created an issue

TypeError: execute() parameters must be strings

  • reflecting tables from postgresql so column names are unicode strings
  • using polymorphic loading
  • convert_unicode=(True|False) had no effect

this patch fixes it for me but other places where reflected strings are used as kwarg keys will cause the same problem

--- mapper.py   (revision 3314)
+++ mapper.py   (working copy)
@@ -1560,7 +1560,7 @@

             params = {}
             for c in param_names:
-                params[c.name](c.name) = self.get_attr_by_column(instance, c)
+                params[str(c.name)](str(c.name)) = self.get_attr_by_column(instance, c)
             row = selectcontext.session.connection(self).execute(statement, **params).fetchone()
             self.populate_instance(selectcontext, instance, row, isnew=False, instancekey=identitykey, ispostselect=True)

Comments (3)

  1. Mike Bayer repo owner

    we support unicode bind param keys, so the issue here lies elsewhere. small test cases are very helpful here since ill have to write one myself in order to locate.

  2. Log in to comment