Free Software to Compare SQLite Databases and Tables: Sqldiff

0 Comments
[yasr_overall_rating] [yasr_visitor_votes]




Sqldiff.exe is a command-line utility program used to Display Differences in content between SQLite databases.

SQLite is written in the C language and is an embed-able SQL database engine. This utility reads & writes direct to a disk file and does not appear to have a dedicated server process. A complete SQLite database with multiple views, indices, tables, and more.

This utility works by detecting rows in the source and destination SQLite databases that are logically paired. Two rows are treated as pairs if they have the same ‘rowids’ and are in tables that have the same names. In case there is now defined ‘rowid’ then the logically paired if they have the same Primary Key. The content differences that are found in the ‘logically paired’ rows are defined as ‘updates’.

Command-line usage of SQLdiff.exe

Sqldiff chinook1.db chinook1.db

This command will transform the chinook.db (source) database file into chinook1.db (destination) file.

The default behavior on the execution of this command can be modified using the following switches

1. –changeset: Do not write or commit the changes. Instead the utility writes the binary changeset into the named file that can be interpreted using the SQLiite Session Extension. This extension provides a way to record changes to the tables in an SQLite database.

Sqldiff chinook1.db chinook1.db –changeset  <Name of file>

Changeset

Changeset Output

2. –lib Library: This switch load the shared DLL named file into the SQLite engine before processing the differences between the two databases.

Sqldiff chinook1.db chinook1.db –lib <Name of DLL file>

3. –primarykey: Uses the primary key defined by the Database Schema. Every row in an SQLite database has a specially defined column called rowid that uniquely identifies that row within the table.

Sqldiff chinook1.db chinook1.db –primarykey

4. –schema: This switch displays only the differences in columns names and tables between the two SQLite databases

Sqldiff chinook1.db chinook1.db –schema

Schema switch

5. –summary: This switch displays number of changed rows in each table without displaying the actual changes in the rows.

Sqldiff chinook1.db chinook1.db –summary

Summary switch

6. –table: the entire database content difference is not showed, it will show named table content difference only.

Sqldiff chinook1.db chinook1.db –table <Name of Table>

Table switch

7. –transaction: the output is displayed as a large single transaction.

Sqldiff chinook1.db chinook1.db –transaction

Transaction switch

8. –vtab: This switch adds support for virtual tables like FTS5, rtree and FTS3. These are specialized table modules that provide full text search functionality to database applications

Sqldiff chinook1.db chinook1.db –vtab

Click here to download this command line utility and choose one of the precompiled binaries for Windows.

[yasr_overall_rating]
[yasr_visitor_votes]
Free/Paid: Free

Leave A Reply

What do you think?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
1 Comments
  • Latest
  • Oldest
  • Hottest
Konstantin2023-11-09

Thanks for review!

Sqldiff is good for those who prefers command line. I can also recommend KS DB Merge Tools for those who prefers GUI (I am the author). There is a free version available which is pretty functional for diff/compare needs: you can get list of new/changed tables (and other objects), see what’s changed, compare table data, see new/changed records, get the total changes counts per table. There is also a web version providing almost all the same except data diff totals.

Few notes regarding features mentioned in this review (not very important for the most of use cases):

  • currently there is no way to attach library (similar to --lib)
  • primary key is used by default, from the logical point of view rows are identified by primary key and row IDs can provide false-positive changes
  • the free version has no something similar --summary, data changes totals are shown only per table
  • some virtual tables can be not supported, it handles only those which are shipped with SQLite library used by the app.
Powered by Waline v3.5.5