[sqlalchemy] returning a dynamic query from Column.default callable

2016-03-19 Thread Jonathan Beluch
Background: Using core we have tables defined in a few separate files. Goal: To have column defaults be selectables which reference other tables while avoiding circular imports. To avoid circular imports I cannot always build the selects at import time, they have to be generated inside a functio

Re: [sqlalchemy] returning a dynamic query from Column.default callable

2016-03-19 Thread Mike Bayer
On 03/17/2016 04:47 PM, Jonathan Beluch wrote: Background: Using core we have tables defined in a few separate files. Goal: To have column defaults be selectables which reference other tables while avoiding circular imports. To avoid circular imports I cannot always build the selects at import

Re: [sqlalchemy] returning a dynamic query from Column.default callable

2016-03-19 Thread Mike Bayer
Just core, you can some_table.append_column(Column(... whatever...)) at any time.The only "event" I can think of are the DDL attachment events: from sqlalchemy import * from sqlalchemy import event m = MetaData() table_a = Table( 'a', m, Column('id', Integer) ) @event.listens_fo

Re: [sqlalchemy] returning a dynamic query from Column.default callable

2016-03-19 Thread Jonathan Beluch
Awesome, both look good, will try them out. Thanks for the quick reply. On Thursday, March 17, 2016 at 3:54:11 PM UTC-6, Mike Bayer wrote: > > Just core, you can some_table.append_column(Column(... whatever...)) at > any time.The only "event" I can think of are the DDL attachment > events:

Re: [sqlalchemy] returning a dynamic query from Column.default callable

2016-03-18 Thread Jonathan Beluch
We're just using core, is there some equivalent? On Thursday, March 17, 2016 at 3:19:23 PM UTC-6, Mike Bayer wrote: > > > > On 03/17/2016 04:47 PM, Jonathan Beluch wrote: > > Background: Using core we have tables defined in a few separate files. > > Goal: To have column defaults be selectables w