Set out to make an app use two different databases today; one for a high-write-volume set, the other for low-volume mostly-read set. It's a TurboGears 2.0 application using SQLAlchemy. I'd half-way hoped for "tell these tables they're in that db" and then have the ORM figure out all the magic of which session to use for queries, how to "join" across the two databases efficiently, and generally just... you know... magic it all away so I can sling tables hither and fro without a care in the world.
I got it all working, but it required manually managing the connections at every point where the two databases reference each other (or rather, the two sets of objects, there's only one-way pointers at the DB level). That wasn't horrible, but it didn't make me go "wow, that was clean and elegant".
I wanted "relations" in all but name, queries across the DB that would let the code continue to say "x.yes" to get the collection of yes in the other DB, with all the ORM-y goodness, adding items to the collection, passing object references and having them auto-convert to foreign-key field references, etc. Basically, I wanted the old code to just work, even if it did have to do some magic behind the scenes.
Maybe SQLAlchemy 0.7 makes it all magic? Oh well, for now I'm almost done the transition, and I'm not sure I'd really be all that satisfied with the magic anyway, after all, magic does have a habit of blowing up in your face.
Pingbacks are closed.