I use declarative to define database scheme, and binds parameter to
session constructed from several metadata tables lists. And I have a
problem with inherited models, where table is represented as Join
object: get_bind() method doesn't find an engine. A quick-n-dirty
solution I use is:
class Session(orm.session.Session):
def get_bind(self, mapper, clause=None):
from sqlalchemy.orm.util import _class_to_mapper
if mapper is not None and clause is None:
c_mapper = _class_to_mapper(mapper)
if hasattr(c_mapper, 'mapped_table'):
clause = mapper.mapped_table
return orm.session.Session.get_bind(self, mapper, clause)
Is it a bug in SQLAlchemy or I use it inapropriately? What is correct
solution?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---