The situation is as follows: let's say there are two servers s_1 and s_2 . Using sqlalchemy I extract the summary table from the first (table t_1 ) and the second server (table t_2 ). The table I need is a table obtained through join () by id_1 for t_1 and id_2 for t_2 .

Question : Is it possible to somehow hold this join for tables t_1 and t_2 stored on different servers? (If it is possible to make it look like the code below, it would be the best solution)

... result_table = select([ t_1.c.field_1, t_2.c.field_2 ]).select_from( t_1.join( t_2, t_1.c.id_1 == t_2.c.id_2 ) ) ?? how to execute this query ?? 

    1 answer 1

    Join is not produced by alchemy, but by means of a database ..

    Probably you need to configure this all in the database itself (if the database allows it) so that the second table will either "replicate" from another server - or be a "connection" (cross-database-querying)

    I can be wrong but about the strategy of "external connection" google https://www.compose.com/articles/cross-database-querying-in-compose-postgresql/