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 imported) as the connection string comes from 
> the environment.
> 
> Is there any way I can set the above to defer the autoloading until the 
> metadata is bound to an engine?


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 is way better than what you'd get with classical mappings:

http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DeclarativeReflectedBase


-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to