identity_key() only accepts tuple as ident

Issue #2508 resolved
Former user created an issue

(original reporter: taha_jahangir) The documentation says that in call to identity_key(cls, ident), ident is primary key and MAY be tuple.

But when calling identity_key(Entity, 3), this exception will be raised:

  File "/home/....py", line 166, in by_id_lock
    id_key = identity_key(cls, id) # id is an integer
  File "/usr/local/lib/python3.2/dist-packages/SQLAlchemy-0.7.7-py3.2.egg/sqlalchemy/orm/util.py", line 202, in identity_key
    return mapper.identity_key_from_primary_key(ident)
  File "/usr/local/lib/python3.2/dist-packages/SQLAlchemy-0.7.7-py3.2.egg/sqlalchemy/orm/mapper.py", line 1599, in identity_key_from_primary_key
    return self._identity_class, tuple(primary_key)
TypeError: 'int' object is not iterable

Comments (2)

  1. Log in to comment