]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
bind parameter conflict in _get() resolved
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 25 May 2006 18:20:39 +0000 (18:20 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 25 May 2006 18:20:39 +0000 (18:20 +0000)
lib/sqlalchemy/orm/query.py

index ef26fee4f7963f88f93f8c76b3b220ac3d9d278b..cfd89411a7689f374b05b15808d6c8a603dc8ee6 100644 (file)
@@ -24,7 +24,7 @@ class Query(object):
         if not hasattr(mapper, '_get_clause'):
             _get_clause = sql.and_()
             for primary_key in self.mapper.pks_by_table[self.table]:
-                _get_clause.clauses.append(primary_key == sql.bindparam("pk_"+primary_key.key))
+                _get_clause.clauses.append(primary_key == sql.bindparam("pk_"+primary_key._label))
             self.mapper._get_clause = _get_clause
         self._get_clause = self.mapper._get_clause
     def _get_session(self):
@@ -266,7 +266,7 @@ class Query(object):
         i = 0
         params = {}
         for primary_key in self.mapper.pks_by_table[self.table]:
-            params["pk_"+primary_key.key] = ident[i]
+            params["pk_"+primary_key._label] = ident[i]
             # if there are not enough elements in the given identifier, then 
             # use the previous identifier repeatedly.  this is a workaround for the issue 
             # in [ticket:185], where a mapper that uses joined table inheritance needs to specify