you can query the three databases with one session, docs on that are at https://docs.sqlalchemy.org/en/14/orm/persistence_techniques.html#simple-vertical-partitioning
from there, you can make *really basic* relationships between classes that are in two databases. as far as how they load, it *in theory* should work with lazyload and immediateload and maybe even selectinload, as all of these strategies generally query one table at a time and should target to the appropriate database, though I've never tried it with selectinload. persistence should work as it targets per-table database binds. I dont know how often people do something like this since I never hear about it, but we've supported it since the beginning. On Wed, Aug 17, 2022, at 3:55 AM, Carl Brewer wrote: > > I have three databases to work with, a PostgreSQL database on one > server, and two MySQL databases on another. > > I've set up three different engines to connect to and reflect each one, > the databases and tables within don't have relationships defined in the > databases themselves, there's not a lot of foreign keys! > > I'm wondering if it's possible to use SQLAlchemy to map out > relationships between them? Only within the particular bit of software > I'm working on, I don't expect it to export back into the databases - at > the moment I'm only using read-only access to the databases anyway. > > Possible within the SQLAlchemy environment? > > Thank you > > Carl > > > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > 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] > <mailto:sqlalchemy%[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/f0a0380d-3c61-cf9c-8a5a-b1d8fc16d3b4%40bl.echidna.id.au. > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/06a805ec-6497-419d-935c-fd26e798cebb%40www.fastmail.com.
