Implements the ability to merge tables from one or more source SQLite
databases into a destination database, as requested in #491.
Python API:
db.merge([src1, src2], alter=True, replace=False, ignore=False, tables=None)
- source_dbs can be Database objects or file paths
- Tables not in dest are created; existing tables have rows inserted
- alter=True adds missing columns to existing destination tables
- replace=True overwrites rows with matching primary keys
- ignore=True skips rows with conflicting primary keys
- tables= limits which tables are merged
- Virtual tables and their shadow tables are automatically skipped
CLI:
sqlite-utils merge combined.db one.db two.db [options]
- Supports --alter, --replace, --ignore, --pk, --table, --load-extension
Closes#491