Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread Mike Bayer
I've updated the documentation and in a few hours it should be up at https://docs.sqlalchemy.org/en/latest/orm/persistence_techniques.html#simple-vertical-partitioning On Tue, Nov 6, 2018 at 3:04 PM wrote: > > Oh, it's perfect for me if I can use bases for bindings. > > Thank you > > Le mardi 6

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread yoch . melka
Oh, it's perfect for me if I can use bases for bindings. Thank you Le mardi 6 novembre 2018 21:27:19 UTC+2, Mike Bayer a écrit : > > On Tue, Nov 6, 2018 at 2:20 PM > wrote: > > > > I have many classes, so it's seems a better idea to use something like > that (but I don't know what exactly is

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 2:20 PM wrote: > > I have many classes, so it's seems a better idea to use something like that > (but I don't know what exactly is this registry, and why it's a WeakRef dict) > : > > binding = {cls: engine for cls in Base._decl_class_registry.values()} see I don't want

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread yoch . melka
I have many classes, so it's seems a better idea to use something like that (but I don't know what exactly is this registry, and why it's a WeakRef dict) : binding = {cls: engine for cls in Base._decl_class_registry.values()} If not, maybe I can use the second approach, overloading Session,

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 9:41 AM wrote: > > Hi, > > I'm using a schema with multiple DB, like : > > engine1 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db1)) > engine2 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db2)) > > Then I use automap and reflection to

[sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread yoch . melka
Hi, I'm using a schema with multiple DB, like : engine1 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db1 )) engine2 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db2 )) Then I use automap and reflection to generate mapping of all classes needed. Sometime, I