Hi all, thanks for this really helpful list.

My question now involves trying to figure out the correct way to map
this legacy database to SqlAlchemy objects using the declarative_base
model.

This database has two main tables, members, and member_profiles, where
a memberID is the foreign key from members to member_profiles.

It then has about thirty other tables such as this one, called
member_gender. member_gender contains a genderID, and a string
representing 'Male' or 'Female'.
genderID is a foreign key in member_profiles, pointing to
member_gender.

So the member_profiles table contains many of these xxxID fields which
are foreign keys into many other tables which act as descriptor
tables, abstracting (to the point of overkill) just about every bit of
data in this database.

The Left Join on member_profiles, to get all of the data I need in one
fell swoop, is over 50 lines long.

I want to use the declarative_base class model to represent this
database in SqlAlchemy, but here are problems I face:

1: Multiple inheritance is not allowed, so I cannot create a class for
every table and inherit them all into one master class.

2: If I create three classes, for example, say Members,
MemberProfiles, and Gender, and use Members as the base class for
MemberProfiles, and MemberProfiles as the base class for Gender, the
Members 'class members' are not visible via Gender. The inheritance
seems to only go two objects deep.

I want to be able to access the gender 'descriptor' field containing
the string 'Female' from one master object, instead of accessing
'genderID'. I want to be able to do this for all foreign keys in this
member_profiles table.

Is there a way to properly make such a model using the
declarative_base methodology, which allows for three or four levels of
foreign key resolution in some 'master' object, containing all of the
fields I want?

Many many thanks in advance,
Gloria

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to