Then cut and paste the external database paths into the working SQL statements. Do not delete duplicates in the initial merge. Skip to content. Star New issue. Jump to bottom. Is there a way to merge 2. Labels question. Copy link. Because SQLite imposes a limit on the number of databases that can be attached at one time, there is no way to do what you want in a single query. If the number can be guaranteed to be within SQLite's limit which violates the definition of "arbitrary" , there's nothing that prevents you from generating a query with the right set of UNION s at the time you need to execute it.
To support truly arbitrary numbers of tables, your only real option is to create a table in an unrelated database and repeatedly INSERT rows from each candidate:. You will generally have 2 types of tables: reference tables, and dynamic tables. Reference tables have the same content across all databases, for example country codes, department codes, etc.
Dynamic data is data that will be unique to each DB, for example time series, sales statistics,etc. The reference data should be maintained in a master DB, and replicated to the dynamic databases after changes.
To support truly arbitrary numbers of tables, your only real option is to create a table in an unrelated database and repeatedly INSERT rows from each candidate:.
You will generally have 2 types of tables: reference tables, and dynamic tables. Reference tables have the same content across all databases, for example country codes, department codes, etc. Dynamic data is data that will be unique to each DB, for example time series, sales statistics,etc. The reference data should be maintained in a master DB, and replicated to the dynamic databases after changes.
When merging these from different DBS , the data will be unique. Then, it is up to you how you will do this replication, pseudo-realtime or brute force, truncate and rebuild the full dynamic every day or as needed. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 10 years, 11 months ago.
Active 7 years, 11 months ago. Viewed 20k times. Users ; is NOT a valid answer because I have an arbitrary number of database files that I need to merge. Why are you not willing to combine the table objects not the DB file logically in the client in a query? If you are willing to specify the databases files to be merged the number of which this week might be 5 but next week 7 or 3 why can't you do the same only in a query?
The reason for this is that the other files are on remote servers which may or may not be up. I already have an abstraction that allows them to appear to be local files. Furthermore, they contains different, but not required data to the local database.
0コメント