■■■PythonでSQLiteの差分を抽出する

■test結果

db1_test.db  ・・・レコード数19011
db2_test.db  ・・・db1から2レコード(row番号3476と19011)を削除

↓コマンドプロンプトでの記録
---------------------------------------------------------------------------
Microsoft Windows [Version 10.0.19045.2965]
(c) Microsoft Corporation. All rights reserved.

●実行ディレクトリをデスクトップに設定
C:\Users\shienkikou11>cd\Users\shienkikou11\Desktop

●実行コマンド
C:\Users\shienkikou11\Desktop>sqldiff db1_test.db db2_test.db

●実行結果(標準出力)
DELETE FROM test_info_corp WHERE rowid=3476;
DELETE FROM test_info_corp WHERE rowid=19011;

C:\Users\shienkikou11\Desktop>
---------------------------------------------------------------------------


■PythonでSQLiteの差分を抽出する


出展:


出展:

 



sqldiff [options] database1.sqlite database2.sqlite

Usage
The sqldiff.exe binary is a command-line utility program that displays content differences between SQLite databases. Example usage:

sqldiff [options] database1.sqlite database2.sqlite
The usual output is an SQL script that will transform database1.sqlite (the "source" database) into database2.sqlite (the "destination" database). This behavior can be altered using command-line switches:

--changeset FILE
Do not write changes to standard output. Instead, write a (binary) changeset file into FILE. The changeset can be interpreted using the session extension to SQLite.

--lib LIBRARY
-L LIBRARY
Load the shared library or DLL file LIBRARY into SQLite prior to computing the differences. This can be used to add application-defined collating sequences that are required by the schema.

--primarykey
Use the schema-defined PRIMARY KEY instead of the rowid to pair rows in the source and destination database. (See additional explanation below.)

--schema
Show only column name and table differences in the schema, not the table content

--summary
Show how many rows have changed on each table, but do not show the actual changes

--table TABLE
Show only the differences in content for TABLE, not for the entire database

--transaction
Wrap SQL output in a single large transaction

--vtab
Add support for handling FTS3, FTS5 and rtree virtual tables. See below for details.