On Jan 28, 2008, at 3:09 PM, Manlio Perillo wrote:
> > Michael Bayer ha scritto: >> >> On Jan 28, 2008, at 6:03 AM, Manlio Perillo wrote: >> >>> Hi. >>> >>> In this wiki page: >>> http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers >>> >>> there is a recipe on how to add basic foreign key support to SQLite >>> using triggers. >>> >>> Is it possible to implement this recipe in SQLAlchemy? >>> >>> Some time ago I have tried to implement it, by adding support for >>> triggers in SQLAlchemy (so that they can be automatically >>> created/dropped) but I have abandoned the project because the >>> internals >>> of SQLAlchemy are unstable. >> >> >> we have ticket 903 http://www.sqlalchemy.org/trac/ticket/903 with a >> suggested way we'll be accomplishing this, a generic DDL() construct >> that associates with table/metadata creates/drops. we just haven't >> decided on exact API details but comments are welcome. >> > > Thanks. > I like the idea of custom events. > > However, instead of having: > table.events['after-create'].append(run) > > IMHO it is better an higher level: > table.add_event(phase, event_type, callable, *args, **kwargs) > > Where phase is "create" or "drop" and event_type is "before" or > "after". > what I like about *my* version, i.e. not the events[] version but the previous DDL(postcreate=".."), is that the keyword argument interface provides Python-based validation of the keywords you're using, which also show up nicely in docstrings. Using strings like 'after-create' feels icky as we have to reimplement validation of "unknown keyword 'after-createee'". --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---