Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-28 Thread Chris Withers
On 27/09/2011 18:48, Michael Bayer wrote: (Note to readers: Chris and I hang out each year at Pycon. He's a great guy, so forgive the colloquial tone I take with him !) Likewise, I should point out I have huge amounts of respect for Mike, so if I'm grumbling, it's usually 'cos he's right

[sqlalchemy] delcarative with autoload when you have no connection

2011-09-27 Thread Chris Withers
Hi All, Say I have a class such as: class MyObj(Base) __tablename__='mytable' __table_args__=dict(autoload=True) ...but the Base's metadata isn't bound, and won't be until the app has started (ie: the model has been imported) as the connection string comes from the environment. Is

Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-27 Thread Michael Bayer
On Sep 27, 2011, at 10:50 AM, Chris Withers wrote: Hi All, Say I have a class such as: class MyObj(Base) __tablename__='mytable' __table_args__=dict(autoload=True) ...but the Base's metadata isn't bound, and won't be until the app has started (ie: the model has been

Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-27 Thread Chris Withers
On 27/09/2011 16:58, Michael Bayer wrote: ah, hm. interesting ! basically, not rea..^H^H^H OK actually this is very easy, using a technique I used previously to create abstract concrete mappers. This should probably be how we recommend people use reflection with mappings since this

Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-27 Thread Michael Bayer
On Sep 27, 2011, at 12:49 PM, Chris Withers wrote: On 27/09/2011 16:58, Michael Bayer wrote: ah, hm. interesting ! basically, not rea..^H^H^H OK actually this is very easy, using a technique I used previously to create abstract concrete mappers. This should probably be how we

Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-27 Thread Chris Withers
On 27/09/2011 18:10, Michael Bayer wrote: That looks like it should ship with SA itself... Does it? on the website, sure :) Many of these things are better as recipes Meh, that used to be true of mixins. I'm very glad that's now in the core. The trouble with keeping this as a recipe is

Re: [sqlalchemy] delcarative with autoload when you have no connection

2011-09-27 Thread Michael Bayer
On Sep 27, 2011, at 1:21 PM, Chris Withers wrote: On 27/09/2011 18:10, Michael Bayer wrote: That looks like it should ship with SA itself... Does it? on the website, sure :) Many of these things are better as recipes Meh, that used to be true of mixins. I'm very glad that's now