Skip to content

reflected unicode column names used as keyword args #739

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot
Collaborator

Migrated issue, originally created by Anonymous

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)

Activity

sqlalchemy-bot

sqlalchemy-bot commented on Aug 15, 2007

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

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.

sqlalchemy-bot

sqlalchemy-bot commented on Aug 15, 2007

@sqlalchemy-bot
CollaboratorAuthor

Michael Bayer (@zzzeek) wrote:

fixed in 2708a34

sqlalchemy-bot

sqlalchemy-bot commented on Aug 15, 2007

@sqlalchemy-bot
CollaboratorAuthor

Changes by Michael Bayer (@zzzeek):

  • set milestone to "0.4.0"
  • changed status to closed
added this to the 0.4.0 milestone on Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingorm

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sqlalchemy-bot

        Issue actions

          reflected unicode column names used as keyword args · Issue #739 · sqlalchemy/sqlalchemy