Hello,

First of all, I'm a real newbie to sqlalchemy.

I'm evaluating sqlalchemy to port an old app to python. Unfortunately I
can't change the db structure (at least atm), and i have trouble with
mapping data to python objs.

Here's my pb, given the following tables (which reflect the actual
structure):


lang_table = Table("lang", metadata,
    Column("id", Integer, primary_key = True),
    Column("lang_id", String(2), nullable=False, unique="lang_id_idx")
)

trans_table = Table("translation", metadata,
    Column("id", Integer, primary_key = True),
    Column("lang_id", Integer, ForeignKey("lang.id"), nullable=False, 
unique="trans_idx"),
    Column("trans_id", Integer, ForeignKey("lang.id"), nullable=False, 
unique="trans_idx"),
    Column("trans_txt", String(50), nullable=False)
)



the trans_table has two foreign keys to lang_table.id.

How would you map this to python class to have Translation objects with
properties like:
trans.lang_id = 'en'
trans.trans_id = 'de'
trans.trans_txt = 'English'

I tried to adapt all example i could find in the docs, and in the
example dir, but it always either chokes on the relation (there must be
something i don't get) or all i have in lang_id and trans_id properties
are integer ids.

thanks for any help/explanation

lekma


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sqlalchemy
-~----------~----~----~----~------~----~------~--~---

Reply via email to