Hi,
I've tried and searched the forum but there's something happening with
my TG2 model and sqlalchemy that's in my way:
I've written a file named address.py with two classes, Address and
City and imported both in my __init__.py.
Now I want to have them related as one to many and wrote:
__all__ = ['Address', 'City']
class City(DeclarativeBase):
__tablename__ = 'tg_city'
#{ Columns
#{ Relations
addresses = relation('Address', order_by=Address.id,
backref='city')
and
class Address(DeclarativeBase):
__tablename__ = 'tg_address'
#{ Columns
#{ Relations
city_id = Column(Integer, ForeignKey('city.id'))
city = relation('City', backref=backref('addresses',
order_by=id))
But starting my app gives me the error
addresses = relation('Address', order_by=Address.id, backref='city')
NameError: name 'Address' is not defined
so I checked my auth.py file as an example but cannot see anything
missing in my adres.py file.
Does somebody have any suggestions what can be wrong?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---