Hello,

I'm using sqlalchemy 0.6.0, and reflecting a couple of tables to
retrieve data. I'm not particularly interested in modifying the data
for now.

One of the tables has a Foreign Key to the other, and has multiple
rows for each row in the main table. The purpose of this is to allow
"custom fields" as defined by users.
When retrieving the data from the main table, how can I access the
rows in the table that has the Foreign Key (the "custom fields")
easily?
I am used to the Django ORM, which gives you convenient access to
associated tables through a property of each row. Any way to have
something similar in sqlalchemy when working with reflected tables?
I am specifying the Foreign Key during reflection.

Here is the code for the reflection of the tables that I am using:

teachers = Table("teachers", meta,
        Column('dcid', Integer, primary_key=True),
        autoload=True)

teachers_custom_fields = Table("pvsis_custom_teachers", meta,
        Column('field_name', String(50), primary_key=True),
        Column('teacherid', Integer, ForeignKey("teachers.dcid"),
primary_key=True),
        autoload=True)

Thanks!!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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