SQLite allows a program to attach multiple databases to a singleconnection, and you are able to reference tables in these additionaldatabases with things like schema.table as the name of a table.Is there a way to do this in SQLAlchemy?
I am working on an application that will want to import data fromanother database (that uses basically the same schema, maybe just asubset of the schema of the main database), and get the updates neededto perform by using a join on unique keys (that aren't necessarily theprimary key).After finishing the update, and pulling the information in (remappingrowid/primary keys <-> foreign keys that didn't match between thedatabases) I would then detach this database (which ideally I opened asa read only connection).I can see how to establish multiple engines and sessions, but then Ican't do the join between the databases which would let me do a lot ofthe work down in the database engine. I also have found being able tobind different sets of tables into different engines, but in my case thedatabase will have the same set of tables, so this doesn't look to work.--Richard Damon
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo 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 sqlalchemy+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/93932507-f4b8-d378-8db6-28636d7a0825%40Damon-Family.org.
Ok, I guess I knew you could execute explicit SQL but wasn't thinkingabout it or coming across it in my searches. In my case I wouldn't wantto automatically connect, as it will be done at a specific time for aspecific operation, so I could do the ATTACH specifically.
Will I need to explicitly recreate all the schema for the tables? Thissecond database will have an identical schema to the main (in fact, itwill be generated by the program, as this is a way to bring in updates),though maybe I won't bother setting up a full ORM model and be usingmore explicit SQL to get the data.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo 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 sqlalchemy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/037e7fb9-e6f1-df4f-6749-2d218d58dd5a%40Damon-Family.org.