Hi,
I've been trying to import a predefined database in the model.py file.
All the examples I have found use assign_mapper that seems to be depracated
and does not work.
My code is the following:
from turbogears.database import bind_meta_data
bind_meta_data()
from sqlalchemy.ext.assignmapper import assign_mapper
event_table = Table("event", metadata, autoload=True)
class Event(object):
pass
assign_mapper(session.context, Event, event_table)
I have also tried to just use mapper (as in the examples of the sqlalchemy
website):
mapper(Event, event_table)
But this doesn't work either.
Does anyone know where I can find working example of importing a predefined
database in model.py or just what I should use instead of assign_mapper ?
Many thanks
--
View this message in context:
http://old.nabble.com/Importing-predefined-database-with-sqlalchemy-tp32463137p32463137.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.