Hey Michael, > 0.2 would easily alllow you to do this: > > e1 = create_engine('someengine1') > e2 = create_engine('someengine2') > > s1 = Session(bind_to=e1) > s2 = Session(bind_to=e2)
This is looking very interesting already! > metadata = MetaData() > mytable = Table('mytable', metadata, columns...) > > m = mapper(MyClass, mytable) > > obj1 = MyClass() > s1.add(obj1) > > obj2 = MyClass() > s2.add(obj2) I wonder about one detail here. When obj1 and obj2 are created, the patched __init__() method will stick them into whatever session was active, and in that case the session.add() call will fail due to the existent _instance_key. Doing something like MyClass(_sa_session=s1) would probably solve it, but that doesn't look like something nice to have spread around the code. It'd probably be possible to use a metaclass to stick the keyword parameter somehow. Are you thinking about extending that support for 0.2, or perhaps I'm missing something you're already supporting? > I was thinking of something more "magical" but if you can deal with > explicit sessioning, there you go ! Actually I am thinking about something more magical, but if SQLAlchemy has the base to support it without too much hackery, I can probably come up with the magic myself. :-) The problem with hacking too deeply into SQLAlchemy is that I'd have to support these hacks forever in a fork. That's what I'm trying to avoid. -- Gustavo Niemeyer http://niemeyer.net ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users