Yes, and I am doing that. The problem becomes when you have two models that have the same named classes. I check to make sure the mapper points to the proper metadata before returning the class.
Question: why is it ok to bind the DBSession, and not the metadata? This seems contradictory in my mind. In case anyone is wondering, DBSprockets need the ability to query the database so it can fill in the proper data for the drop-down menus, as well as to fill in table data. cheers. -chris On Dec 19, 1:29 am, Alberto Valverde <[email protected]> wrote: > percious wrote: > > So, I did some experimentation tonight using the engine as an > > identifier. > > > The problem is that I have no way of knowing which class is mapped to > > which engine without binding them. Maybe I'm missing something > > here... > > from sqlalchemy import orm > mapper = orm.class_mapper(MyClass) > # introspect the mapper... > > This is how RumAlchemy gets information about a mapped class' > properties:http://toscawidgets.org/hg/RumAlchemy/file/tip/rumalchemy/util.py > > IIRC, you don't *need* a connection to a database (engine) to introspect > the mapper. For CRUD operations you just need a reference to DBSession > so you can create Query objects from a mapped class. You can safely > assume that DBSession has already been bound to an engine somehow I guess. > > Alberto --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" 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-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
