Hi,
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',
"CREATE TRIGGER
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 );
END;")
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?
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en.