On Jun 30, 2008, at 1:27 AM, Andreas Jung wrote:

>
>
> --On 29. Juni 2008 16:57:16 -0400 Michael Bayer <[EMAIL PROTECTED] 
> > wrote:
>
>>
>>
>> On Jun 29, 2008, at 12:46 PM, Andreas Jung wrote:
>>
>>> This approach is ugly (because of putting the mapper within the  
>>> local
>>> scope into the global scope (in order to make them importable) and
>>> because
>>> of this code within main.py:
>>>
>>> import model
>>> model.setup(dsn)
>>> from model import MyMapper, Session
>>>
>>> This there any better pattern for implementing this?
>>
>>
>> you don't need to pass DSN as a parameter.  The "engine" argument to
>> declarative_base() is optional, and the docs have been revised in
>> recent months to reflect this.
>>
>
> However the engine is required in order to perform autoloading.
>

not attached to the metadata, you can say Table('foo', metadata,  
autoload=True, autoload_with=engine)

but yes, if you want to load your tables from the DB you need an  
engine.   Alternatives include pickling the loaded table objects to a  
file and loading them in via pickle.loads().



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to