[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part3 relation and flow control

2007-08-27 Thread Lukasz Szybalski
Hello, ok so I got the connection, select statements working using turbogears, assign_mapper and sqlalchemy. Now i need to work out the relation. User has a one to many relation with address, email, accounts. In reverse: address, email and accounts have many to one... #here is my table

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-20 Thread Marco Mariani
Lukasz Szybalski ha scritto: Got another error here. but I guess its fixed in a newer version of sqlalchemy via ticket 482 Yes. I wasn't aware of 482 because I usually try to avoid table names that _must_ be escaped (mixed caps, reserved words, etc). put assign_mapper() in place of

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-17 Thread Marco Mariani
Lukasz Szybalski ha scritto: bind_meta_data() users_table = Table('users', metadata, autoload=True) class Users(object): pass usersmapper=mapper(Users,users_table) assign_mapper() in place of mapper() mysession=session.query(Users) 1. What would be the code from now on to

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-17 Thread Lukasz Szybalski
hello - you generally use mapper() and relation() to set up how you'd like your classes to correspond to your table relationships. as far as compound keys, if they are defined with a primary key constraint you shouldn't have to worry about them. --- Ok. So we are using mapper()

[sqlalchemy] Re: sqlalchemy with turbogears and mapper-part2 connect and select

2007-08-17 Thread Lukasz Szybalski
ok...correct me if I'm wrong. #we start by importing from turbogears.database import metadata, session,bind_meta_data from sqlalchemy.ext.assignmapper import assign_mapper from turbogears import widgets, validators import sqlalchemy #Then we bound to database bind_meta_data() #create a table

[sqlalchemy] Re: sqlalchemy with turbogears and mapper

2007-08-16 Thread Michael Bayer
hello - you generally use mapper() and relation() to set up how you'd like your classes to correspond to your table relationships. as far as compound keys, if they are defined with a primary key constraint you shouldn't have to worry about them. if you need to tell a mapper about some other