- changed status to resolved
check the length of the ident, not the params, so that too-long query._get() ident shows up too
Issue #1977
resolved
diff -r e15fa0342d2ac83414c563abd8fd478251d4d35f lib/sqlalchemy/orm/query.py
--- a/lib/sqlalchemy/orm/query.py Thu Nov 18 20:12:24 2010 -0500
+++ b/lib/sqlalchemy/orm/query.py Fri Nov 19 18:04:59 2010 +0000
@@ -1919,6 +1919,12 @@
q = self._clone()
if ident is not None:
+ if len(ident) != len(mapper.primary_key):
+ raise sa_exc.InvalidRequestError(
+ "Incorrect number of values in identifier to
formulate "
+ "primary key for query.get(); primary key columns are
%s" %
+ ','.join("'%s'" % c for c in
mapper.primary_key))
+
(_get_clause, _get_params) = mapper._get_clause
# None present in ident - turn those comparisons
@@ -1939,12 +1945,6 @@
for id_val, primary_key in zip(ident,
mapper.primary_key)
])
- if len(params) != len(mapper.primary_key):
- raise sa_exc.InvalidRequestError(
- "Incorrect number of values in identifier to
formulate "
- "primary key for query.get(); primary key columns are
%s" %
- ','.join("'%s'" % c for c in mapper.primary_key))
-
q._params = params
if lockmode is not None:
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.6.6 (automated comment)
- Log in to comment
52167e1c37a6d704f01dc15bcb14ec2489979457