Re: [sqlalchemy] Re: Server side column triggers

2017-11-01 Thread Philip Martin
Thanks that is good to know. I threw this up very quickly, but if I did intend to have the mixin also handle creating the stored function, would adding an event to the table's metadata object be the best way to go? Granted, I'm guessing its good practice to inspect the db to see if the function

Re: [sqlalchemy] Re: Server side column triggers

2017-11-01 Thread Mike Bayer
On Wed, Nov 1, 2017 at 9:45 PM, Philip Martin wrote: > Wow. Must have completely missing this in the docs. Thank you for the > sample, it definitely has helped. > > I was looking through the source code and noticed internally many of the DDL > elements inherit from _CreateDropBase versus DDLElemen

Re: [sqlalchemy] Possible inconsistency between schema names and FKs when inspecting SQLite

2017-11-01 Thread Mike Bayer
On Wed, Nov 1, 2017 at 6:43 PM, Jacopo Farina wrote: > Hello everybody, > > I am writing a component of an application that should display a chart of > database tables and foreign keys (this one), and trying to make it database > agnostic. I encountered a strange behavior when inspecting the forei

Re: [sqlalchemy] Re: Server side column triggers

2017-11-01 Thread Philip Martin
Wow. Must have completely missing this in the docs. Thank you for the sample, it definitely has helped. I was looking through the source code and noticed internally many of the DDL elements inherit from _CreateDropBase versus DDLElement. It looks like in these cases, the element object is somet

[sqlalchemy] Possible inconsistency between schema names and FKs when inspecting SQLite

2017-11-01 Thread Jacopo Farina
Hello everybody, I am writing a component of an application that should display a chart of database tables and foreign keys (this one ), and trying to make it database agnostic. I encountered a strange behavior when inspecting the

Re: [sqlalchemy] Re: Server side column triggers

2017-11-01 Thread Mike Bayer
you can use a hook like __declare_first__ to make this happen: class AuditMixin(object): """created_at, updated_at, table audit mixin.""" @classmethod def __declare_first__(cls): table = getattr(cls, '__table__', None) if table is not None: event.listen(

Re: [sqlalchemy] GlobalFilter recipe

2017-11-01 Thread Mike Bayer
On Wed, Nov 1, 2017 at 12:47 AM, Jason Gosnell wrote: > Hi folks, > > Is the GlobalFilter recipe expected to still work with newer versions of > sqlalchemy? I've copied and pasted the code right out of the recipe and get > this assertion: > > 2017-10-31 21:38:22,391 INFO sqlalchemy.engine.base.Eng