Thanks. Yes, in fact, I wanted both the schema and the data.This solution
worked fine.
saikari

Christoph Zwerschke wrote:
> 
> Am 14.09.2011 14:44 schrieb sk78:
>> I've been trying to import a predefined database in the model.py file.
> 
> I guess you want to just use the existing database scheme, not the date.
> 
> You can use the autoload feature of SQLAlchemy to get the tables:
> 
> def init_model(engine):
>      DBSession.configure(bind=engine)
>      global my_table
>      my_table = sqlalchemy.Table('mytable', metadata,
>         schema='public', autoload=True, autoload_with=engine)
> 
> And then map an empty class, or a class with some additional methods or 
> properties, like this:
> 
> sqlalchemy.orm.mapper(MyTable, my_table)
> 
> -- Christoph
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Importing-predefined-database-with-sqlalchemy-tp32463137p32474694.html
Sent from the Turbogears General mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to