[sqlalchemy] Re: Need SqlAlchemy Model Advice for a table with many foreign keys.

2009-02-04 Thread Gloria W
Thanks for this response. I do need all of the data available at once. Specifically, here is what I'm trying to do. I'm following this example right from the docs: from sqlalchemy import ForeignKey from sqlalchemy.orm import relation, backref class Address(Base): ... __tablename__ =

[sqlalchemy] Re: Need SqlAlchemy Model Advice for a table with many foreign keys.

2009-02-04 Thread GHZ
Don't know if this will work in your case.. but to handle joins to so many static tables. Note.. I didn't need to update these tables, nor query from them back to the data tables. (i.e. no need to call Gender.member_profiles()) I did something like the following: class MemberProfile(Base):

[sqlalchemy] Re: Need SqlAlchemy Model Advice for a table with many foreign keys.

2009-02-04 Thread Gloria W
Excellent, thank you! Getting closer. I now use the same declarative_base on all instances, and I can now successfully refer to the relation() classes as actual class names instead of strings. During this query: memberProfile = session.query(MemberProfile).filter_by (memberID=81017).first() I

[sqlalchemy] Re: Need SqlAlchemy Model Advice for a table with many foreign keys.

2009-02-04 Thread Gloria W
Just to make it easier to read, I'm missing a FROM clause: sqlalchemy.exc.ProgrammingError: (ProgrammingError) missing FROM- clause entry for table member_profiles at character 5151 I read from the archive that this was a bug in 0.4. Thanks again, Gloria

[sqlalchemy] Re: Need SqlAlchemy Model Advice for a table with many foreign keys.

2009-02-03 Thread az
so u have a member, pointing to member_profile, pointing to all its attributes into separate tables? one way IMO is to map all other 50 tables into simple classes, then have member profile reference each of them, i.e. relation( .. uselist=False). Then, if u need all of them at once, request a