Correction: on update cascade + event listener works just fine, but the change is not emediately reflected - a call to expire_all() was needed. Sorry for the confusion :)
An alternative (that worked for me) was to install pysqlite and compile sqlite with default_foreign_keys. (This is how I noticed that the event listener in fact works fine.) On Monday, August 4, 2014 7:33:59 PM UTC+2, Mario Žic wrote: > > I have also tried adding onupdate="cascade" to all foreign keys. (I have > also disabled passive updates to avoid conflict during update. I think that > relationship altered values before sqlite got the chance to do it.) I > enforced referential integrity using proposed event listener > <http://docs.sqlalchemy.org/en/rel_0_8/dialects/sqlite.html#dialect-sqlite> > method. This worked fine within the DB, the updates propagated nicely, but > still didn't do the job when PK was altered in Sqlalchemy. I think that > understanding of this behaviour is out of my league for time being :) > > On Monday, August 4, 2014 11:24:52 AM UTC+2, Mario Žic wrote: >> >> Hi, >> >> I have a problem where three tables are linked via relationships A -> B >> -> C, and all the relationships refer to the same property i.e. the primary >> key (PK) of table A is a foreign key (FK) in the table B, and the same FK >> (table B) is a FK in the table C. The example is artificial since I am >> trying to simplify the schema. However, when I modify the PK of A only B >> sees the change after flush. I would expect table C to get updated as well. >> >> The problem and the code is already posted here >> <http://stackoverflow.com/questions/25107861/sqlalchemy-propagation-of-updates-across-multiple-linked-relationships> >> . >> >> I have a feeling this should be sth simple and documented but I had no >> luck so far. >> >> Thanks for the help! >> >> >> * I tested the code using SQLAlchemy 0.7.7 and 0.9.7; the DB is SQLite >> > -- 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. For more options, visit https://groups.google.com/d/optout.