Am 24.05.2013, 17:53 Uhr, schrieb YKdvd <davidobe...@gmail.com>:

but I can't seem to find anything that works.  I can provide some sort of
instance method or property with the necessary id value for foreign(), but
I'm not sure if this is acceptable, or even if the remote reference is
correct (I've tried the string "Studio.productions.id" as well as the
Production.id variable.

Note that you can stuff a join() method with all the conditions you need and this is sometimes unavoidable.

I could probably add a "production_id" column to the episodes table - it
would get filled with the same value for all records in a particular
Production_?.episodes table.  That would let me do a normal foreign_key
relationship and shouldn't break the legacy PHP access. But I was curious if there is a way to torture SQLAlchemy into creating this sort of
non-column relationship?

You really do not want to try to trick SQLAlchemy (or yourself) into even thinking this. Non-existent foreign keys will almost certainly mean a table scan with terrible implications for performance. I recently discovered that MySQL will do this even for indexed columns. :-/ Make the relationship explicit, note dump, truncate, alter, import is often the only way to do this and enjoy the, er, show.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

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


Reply via email to