Hi this is a very naive question, but please help a newbie:-
I have modeled two classes for the database like this:-
class City(DeclarativeBase):
__tablename__='citytable'
id=Column(Integer,primary_key=True)
name=Column(Unicode(50),nullable=False)
country_id=Column(Integer,ForeignKey('countrytable.id'),nullable=False)
country_name=relation('Country',foreign_keys=country_id)
class Country(DeclarativeBase):
__tablename__='countrytable'
id=Column(Integer,primary_key=True)
countryname=Column(Unicode(50),nullable=False)
Now if I have to select all cities from a country say US, am I not
supposed to do this.
citylist=[city.name for city in City.filter_by(name='US')]
and can someone also please help me know how to use sqlalchemy
through CLI.
I used the following codes:-
city_q=DBSession.query(City)
however when I give city_q.all().. I get :-
sqlalchemy.exc.UnboundExecutionError: Could not locate a bind
configured on mapper Mapper|City|citytable
Please help!
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.