> relationship() expects a class or a mapper instance, not a string. I > got this error: > > ArgumentError: relationship 'available_deals' expects a class or a > mapper argument (received: <type 'str'>)
Hmm... I'm not sure what I'm doing wrong but passing strings to relation() definitely works for me: class Host(Base): __tablename__ = 'hosts' id = sa.Column(sa.Integer, primary_key = True) ... datacentre_id = sa.Column(sa.Integer, sa.ForeignKey('datacentres.id')) datacentre = sa.orm.relation('Datacentre', backref='hosts') Can it be because I'm using declarative? In my case I don't even need to import Datacentre class before I declare Host class. -- 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.