Hi there. I have an application that has three different databases in MySQL (InnoDB). They are separated into distinct databases because sometimes I need to reload a database from scratch without impacting the other databases. For this reason, there are no ForeignKey() relationships defined at table creation time between these three databases, so I can wipe and reload an individual database at will.
There are still relationships between the databases, from a SQLAlchemy perspective. Because I don't use ForeignKey(), I need to specify foreign_keys in my relationship, as follows: 'user' : relationship(User, foreign_keys=[User.__table__.c.email], primaryjoin=cls.__table__.c.user_email == User.__table__.c.email), When I have this relationship in my AllocatedHardware object, and I delete an AllocatedHardware record, this has the unfortunate site-effect of deleting the user account from the users table. :( When I leave the foreign_keys parameter out, then SQLAlchemy can't determine the join condition. The behavior I want is for the AllocatedHardware record to go away when I delete it, without impacting my user accounts. Can this be achieved with tweaking the cascade behavior? It seems like an unexpected side-effect that specifying foreign_keys will result in cascading deletes in tables that do not have any db-level foreign key relationships. Thanks and Regards, Daniel -- 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.