Hey guys,
I have a problem when I import classes from one to another. I have
those classes in different modules:
crm.py
from CRMContactInformation import CRMContactInformation
class CRM(rdb.Model):
"""Set up crm table in the database"""
rdb.metadata(metadata)
rdb.tablename("crms")
id = Column("id", Integer, ForeignKey("screens.id"),
primary_key=True)
screen_id = Column("screen_id", Integer, )
contactInformation = relationship(CRMContactInformation,
userlist=False, backref="crms")
....
CRMContactInformation.py
from CRM import CRM
class CRMContactInformation(rdb.Model):
"""Set up crm contact information table in the database"""
rdb.metadata(metadata)
rdb.tablename("crm_contact_informations")
id = Column("id", Integer, ForeignKey(CRM.id), primary_key=True)
owner = Column("owner", String(50))
.....
As you can see, I have a recursive problem because I import
CRMContactInformation in CRM and CRM in CRMContactInformation. I got
this error or similar:
“AttributeError: ‘module’ object has no attribute ”
I tried to change the imports importing the whole path. It didn't work
out either.
Is there any way I can use the metadata object to access the
attributes of the tables? or another way to solve this?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
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.