Another small thing:

I took a look at:

ForeignKeyConstraint(['invoice_id', 'ref_num'], ['invoice.invoice_id', 
'invoice.ref_num'])

Now for Polymorphic tables:


in baseclass:

baseclass.discriminator happens to be the __tablename__ of the polymorphic 

ForeignKeyConstraint('['baseclass.disciminator', baseclass.Id'], 
['someotherclass.tablename','someotherclass.tableId']
relationship('someotherclass', backref=baseclass, cascade="all", lazy="dynamic")


in someotheclass:
        
        tablename = column(Unicode(20), primary_key=True)
        tableId         = column(Integer, primary_key=True)

seems Ok to me.

Now I need to make someotherclass work with non-polymorphic tables too!!

anotherclass:
        Id = column(Integer, primary_key=True)
        
ForeignKeyConstaint('[anotherclass.__tablename__,'anotherclass.Id'],['someotherclass.tablename','someotherclass.tableId'])
        relation('someotherclass', backref=baseclass, cascade="all", 
lazy="dynamic")

Is there any way to get this working without configuring it as polymorphic an 
do no Inhiritance, I do not want each anotherclass record to have a column 
discriminator with its own tablename!

or can I use anotherclass.__tablename__ in the ForeignKeyConstaint?

This has to do with the someotherclass being the "ACL" I talked about in a 
previous post if that gives extra info. I am trying to implement the 
MapperExtension.before_append where I need to refer to the "ACL" records in a 
way like:

for A in instance.ACL:
        .....

Martijn



-- 
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