May 9, 2011, 10:48:23 PM5/9/11
I'm trying to create triggers on a sqlite database.
I can create triggers using a database management tool like
SQLiteStudio. What I
want to do is implement the triggers in my python code.
I've tried using the "perform_ddl" method. I can do simple inserts of
data using the perform_ddl mehtod, but when sqlalchemy creates the
tables it doesn't seem to create my trigger. Here is whats my
statement looks like:
perform_ddl = ('after-create',
tgr_vendor_rma_item_UpdatePartStatusFailed AFTER INSERT ON
vendor_rma_item FOR EACH ROW BEGIN UPDATE Part SET status = 3 WHERE id
= ( SELECT part_id FROM vendor_rma_item WHERE part_id = NEW.part_id );
Am I missing something here? Is there possibly a better way to create
triggers than using the entity's perform_ddl method? Perhaps I need
to do this with sqlalchemy methods?