[Grok-dev] Bug report, megrok.rdb, SQLAlchemy 0.6.6, zope.sqlalchemy 0.6.1

Marco Lempen mlempen at raptus.com
Thu Feb 10 05:00:38 EST 2011


  Dear grok team

I use megrok.rdb for a current project. I checked out the current 
version of megrok.rdb. It install SQLAlchemy 0.6.6 and zope.sqlalchemy 
0.6.1 as dependences. If I define a relation on my rdb.Model it appear 
the following error:

     AttributeError: 'PrimaryKeyConstraint' object has no attribute 'keys'

SQLAlchemy change the PrimaryKeyConstraint in newer versions.


Solution for the problem:

components.py:

OLD:
def default_keyfunc(node):
     primary_keys = node.__table__.primary_key.keys()
     if len(primary_keys) == 1:
         return getattr(node, primary_keys[0])
     else:
         raise RuntimeError(
             "don't know how to do keying with composite primary keys")

NEW:
def default_keyfunc(node):
     primary_keys = node.__table__.primary_key.columns.keys()
     if len(primary_keys) == 1:
         return getattr(node, primary_keys[0])
     else:
         raise RuntimeError(
             "don't know how to do keying with composite primary keys")

Chears
Marco Lempen



More information about the Grok-dev mailing list