all modules which include mapped classes must be imported before you attempt to
initialize the mappings. If class A references B, but class B doesn't
exist, you get errors like that, so importing the modules that contain both
class A and B solves the issue.
On Oct 25, 2010, at 2:55 PM, Alvaro Reinoso wrote:
Hello,
I get errors when I try to create tables one to one relation. Screen
contains crm and crm contains more classes. The relation is one to one
between crm, so I want to use the screen id as primary key in crm. And
the relation is one to one between crm and some classes, I just added
one class as example, so children of crm must contain a screen id as a
primary key. When I try to make the last relation, it's when it
breaks. I tried to use both, crm id and screen id.
I didn't work. I get errors such as, UnmappedClassError when I try
to use crm id in ContactInformation, and Could not determine join
condition between parent/child tables on relationship
CRM.contactInformation. Specify a 'primaryjoin' expression. If this is
a many-to-many relationship, 'secondaryjoin' is needed as well when I
try to use screen id in ContactInformation.
These are my classes:
class Screen(rdb.Model):
Set up screens table in the database
rdb.metadata(metadata)
rdb.tablename(screens)
id = Column(id, Integer, primary_key=True)
title = Column(title, String(100))
crm = relationship(CRM, uselist=False, backref=screens)
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)
contactInformation = relationship(crm_contact_informations,
uselist=False, backref=crms)
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(screens.id),
primary_key=True)
owner = Column(owner, String(50))
...
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.