I'm using SQLAlchemy on an existing database, with some one->many with the many row connecting to a many-many department/status system. The main fields are something like this:
Parent.id Parent.mainStatus Child.id Child.parent_link Child.department_id Child.status_id Department.id DepartmentAssoc.id DepartmentAssoc.department_id DepartmentAssoc.status_id DepartmentAssoc.seqOrder Status.id Status.whatever Each Parent can have multiple Child rows, for different departments. Each department can have a specific sequenced subset of Status rows, so there's a DepartmentAssoc table that provides this. Child has a status value, and does a composite foreign key relationship (department_id, status_id) through DepartmentAssoc to the status system. Everything connects and works fine, and SQLA has those slick AssociationProxy things that make it even better than the original. There's a couple different Parent/Child type setups like this that share that same association setup. Unfortunately, there's also one weird parent variant that also has a naked status code "mainStatus", which implicitly belongs to a specific department (call it #310). The PHP never did complete links with this, but I'd like to provide the same sort of foreign key/association linkage to the status system that the various Child objects have. But since there is no department field in Parent I can't specify that half of the composite. I assume there isn't any way of doing something like ForeignKeyConstraint(['f1', 'f2'], [310, 'da.status_id']) with a constant? I can't think how I'd tell MySQL to do this, so it makes sense you can't. I could probably kludge a department field into that Parent record to make it work, but I was wondering if their is some buried SQLA feature that might be put to use? -- 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.