When I try to access a specific mapped attribute the error below is thrown
but only if I use a custom __eq__().
def __eq__(self, other):
'''
'''
return self.aromatic_ring_id == other.aromatic_ring_id
When I print the type of both, the 'other' class is 'symbol': <class
'credoscript.models.aromaticring.AromaticRing'> <class
'sqlalchemy.util.langhelpers.symbol'>
Any ideas what went wrong?
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/adrian/<ipython console> in <module>()
/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.2-py2.7-linux-x86_64.egg/sqlalchemy/orm/attributes.pyc
in __get__(self, instance, owner)
166 return dict_[self.key]
167 else:
--> 168 return self.impl.get(instance_state(instance),dict_)
169
170 def create_proxied_attribute(descriptor):
/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.2-py2.7-linux-x86_64.egg/sqlalchemy/orm/attributes.pyc
in get(self, state, dict_, passive)
422 value = ATTR_EMPTY
423
--> 424 if value in (PASSIVE_NO_RESULT, NEVER_SET):
425 return value
426 elif value is ATTR_WAS_SET:
/home/adrian/Software/credoscript/models/aromaticring.py in __eq__(self,
other)
48 '''
49 print type(self), type(other)
---> 50 return self.aromatic_ring_id == other.aromatic_ring_id
51
52 def __ne__(self, other):
AttributeError: 'symbol' object has no attribute 'aromatic_ring_id'
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/3kqkVsvmxQ8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.