summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-05-25 15:02:59 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-05-25 15:02:59 +0000
commit7f50a6f8ebc84f86596a861794dc0a9b9368a05c (patch)
tree7f3768d52be5e6c77c033456cb8ccb1b9d507d4e /lib/sqlalchemy/orm/query.py
parente7a1ce9176888e2d048134aff01f697ea3f674e2 (diff)
downloadsqlalchemy-7f50a6f8ebc84f86596a861794dc0a9b9368a05c.tar.gz
workaround for get that requires multiple ids in the case of joined table inheritance
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r--lib/sqlalchemy/orm/query.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index cb51da02a..ef26fee4f 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -267,7 +267,13 @@ class Query(object):
params = {}
for primary_key in self.mapper.pks_by_table[self.table]:
params["pk_"+primary_key.key] = ident[i]
- i += 1
+ # 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
+ # all primary keys of the joined relationship, which includes even if the join is joining
+ # two primary key (and therefore synonymous) columns together, the usual case for joined table inheritance.
+ if len(ident) > i + 1:
+ i += 1
try:
statement = self._compile(self._get_clause)
return self._select_statement(statement, params=params, populate_existing=reload)[0]