How do I get alembic to emit custom DDL on after_create?
问题 I've got a couple of custom DDL statements that I want to run after create table: update_function = DDL(""" CREATE OR REPLACE FUNCTION update_timestamp() RETURNS TRIGGER AS $$ BEGIN NEW.updated_at = now(); RETURN NEW; END; $$ language 'pgplsql'; """) update_trigger = DDL(""" CREATE TRIGGER update %(table)s_timestamp BEFORE UPDATE ON %(table)s FOR EACH ROW EXECUTE PROCEDURE update_timestamp(); """) And I've attached them like this: event.listen(Session.__table__, 'after_create', update