SQLAlchemy is better for accessing legacy DB. Massimo
On Oct 2, 4:16 pm, Ivan Matveev <[email protected]> wrote: > 2010/10/2 Mariano Reingart <[email protected]> > > > > > > > Did you try string notation for references? > > > db.define_table('cars', > > Field('car_id','integer'), > > Field('model_id', "reference car_models.model_id"), > > Field('note','text'), > > primarykey=['car_id'], > > migrate=False > > ) > > > Anyway, if you are using single-field integer primary keys, i think > > you may try "id" field type: > > > db.define_table('car_models', > > Field('model_id','id'), > > Field('model_name','string'), > > migrate=False > > ) > > > db.define_table('cars', > > Field('car_id','id'), > > Field('model_id','reference car_models'), > > Field('note','text'), > > migrate=False > > ) > > Tried both: string notation for references and making primary key field type > 'id'. No luck. > > Now I'm looking at SQLAlchemy(SA). Want to try to use it as legacy db > backend. It is realy easy to get db scheme from a db with SA. Just 3 lines > of code: > > engine = create_engine('mysql://myuser:myp...@localhost/mydb', echo=True) > metadata = MetaData() > metadata.reflect(bind = engine) > > and the scheme is in metadata, ready to provide access to all tables in the > db.

