the answer is simple in that the "binds" argument to Session precedes both
Declarative as well as the advent of the __abstract__ keyword; it typically
expects actual Mapper objects or classes from which a Mapper can be pulled
directly.
For now, you can instead override get_bind() to do whatever you want it to do:
class MySession(Session):
def get_bind(self, mapper=None, clause=None):
if mapper is not None:
if mapper.class_.issubclass(DB1):
return bind1
elif mapper.class_.issubclass(DB2):
return bind2
return super(MySession, self).get_bind(mapper=mapper, clause=clause)
https://bitbucket.org/zzzeek/sqlalchemy/issue/3035/overhaul-sessionbinds-to-support-classes
is added for this.
On Apr 26, 2014, at 5:21 PM, Brian Findlay <[email protected]> wrote:
> Continuing to troubleshoot. This produces the same exception:
>
> DBSession.configure(binds={DB1: db1_engine, DB2: db1_engine})
>
>
> Note that I'm binding both classes to the original engine. I thought it would
> be the same as the working config:
>
> DBSession.configure(bind=db1_engine)
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.