Skip to main content

Differential analysis of sqlite files

Project description

Description

Differential analysis of sqlite files based on primary key (rowid)

Detects changes between versions of sqlite files:

  • Database Table
    • Table created
    • Table deleted
  • Table Row
    • Row created
    • Row modified
    • Row deleted

Installation

pip install sqlitediff

Usage

From command line:

python -m sqlitediff --pathBefore PATHBEFORE --pathAfter PATHAFTER [--primaryKey PRIMARYKEY]

Option Short Type Default Description
--pathBefore -b String - Path to sqlite file before action
--pathAfter -a String - Path to sqlite file after action
--primaryKey -p String rowid Name of the primary key column
--printSnapshot -s String - before = Prints the before snapshot
after = Prints the after snapshot

Example

python -m sqlitediff -b path/to/before.db -a path/to/after.db

################################################################################

sqlitediff by 5f0
Differential analysis of sqlite files

Current working directory: path/to/sqlitediff

Sqlite file before action:
-->    Path: path/to/before.db
-->     MD5: d7e88c55c4ec6ed7cd7fa6c6cb8b0b45
-->  SHA256: 19722a52443837b2cc7ac77fa806da6f2e1f307707ac8a2fdfe6a5c097758faf

Sqlite file after action:
-->    Path: path/to/after.sqlite
-->     MD5: 305d12c0b2b49b149a508d9d4cb7d573
-->  SHA256: 3073be75fb6b0ace2ffc94332c2c77e1fe12c6f618c840c122112a61ee63585a

Datetime: 01/01/1970 11:12:13

################################################################################

Table Analysis
---

--> Tables before: 
         --- 
         List: ['dog', 'fish']
         --- 
         Name: dog
         Rows: 2
         --- 
         Name: fish
         Rows: 4
         --- 

--> Tables after: 
         --- 
         List: ['fish', 'snowman']
         --- 
         Name: fish
         Rows: 5
         --- 
         Name: snowman
         Rows: 1
         --- 

--> Deleted Tables: 
         --> ['dog']

--> Created Tables: 
         --> ['snowman']


Row Analysis
---

--> snowman
    ---
    Colums:
    ---
     --> ['id', 'name', 'species', 'fridge']
    ---
    Created: [1]
    ---
     --> (1, 'olaf', 'snow', 1)
    ---

--> dog
    ---
    Colums:
    ---
     --> ['id', 'name', 'species', 'garden']
    ---
    Deleted: [1, 2]
    ---
     --> (1, 'Bill', 'shepard', 1)
     --> (2, 'Tom', 'little', 7)
    ---

--> fish
    ---
    Colums:
    ---
     --> ['id', 'name', 'species', 'tank']
    ---
    Created: {5, 6}
    ---
     --> (5, 'Leo', 'whale', 3)
     --> (6, 'Ole', 'delfin', 4)
    ---
   Updated: [2, 4]
    ---
     --> (2, 'Jamie', 'cuttlefish', 7)
     --> (2, 'Jamie', 'cuttlefish', 77)
    ---
     --> (4, 'Mark', 'bigfish', 9)
     --> (4, 'Mark', 'bigfish', 99)
    ---
    Deleted: {1}
    ---
     --> (1, 'Sammy', 'shark', 1)
    ---

################################################################################

Execution Time: 0.010948 sec

python -m sqlitediff -b path/to/before.db -a path/to/after.db -s before

################################################################################

sqlitediff by 5f0
Differential analysis of sqlite files

Current working directory: path/to/sqlitediff

Sqlite file before action:
-->    Path: path/to/before.db
-->     MD5: d7e88c55c4ec6ed7cd7fa6c6cb8b0b45
-->  SHA256: 19722a52443837b2cc7ac77fa806da6f2e1f307707ac8a2fdfe6a5c097758faf

Sqlite file after action:
-->    Path: path/to/after.sqlite
-->     MD5: 305d12c0b2b49b149a508d9d4cb7d573
-->  SHA256: 3073be75fb6b0ace2ffc94332c2c77e1fe12c6f618c840c122112a61ee63585a

Datetime: 01/01/1970 11:12:13

################################################################################

Snapshot Name: before
---
   Table Name: fish
         Rows: 4
      Columns: ['id', 'name', 'species', 'tank']
   Row Values: 
          --- 
           --> (1, 'Sammy', 'shark', 1)
           --> (2, 'Jamie', 'cuttlefish', 7)
           --> (3, 'Carl', 'goldfish', 8)
           --> (4, 'Mark', 'bigfish', 9)
          --- 
---
   Table Name: dog
         Rows: 2
      Columns: ['id', 'name', 'species', 'garden']
   Row Values: 
          --- 
           --> (1, 'Bill', 'shepard', 1)
           --> (2, 'Tom', 'little', 7)
          --- 
---

################################################################################

Execution Time: 0.010948 sec


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlitediff-1.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlitediff-1.0.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file sqlitediff-1.0.0.tar.gz.

File metadata

  • Download URL: sqlitediff-1.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for sqlitediff-1.0.0.tar.gz
Algorithm Hash digest
SHA256 276b20e80d1fbc135585a98a1d469767c2b4092952d660b237d636c5ce567411
MD5 987fec36c61474582a806f6c90ff4d0f
BLAKE2b-256 0e1373bb8d57c25e4fab862dc0e70b77b8a3a92e1b0bfbde1b7e9cb9b3c0fc3c

See more details on using hashes here.

File details

Details for the file sqlitediff-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sqlitediff-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for sqlitediff-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a378492cf5007b3416c045fe9ff4dfeb6f98575c1153bcc3249a76e7a16f8b6d
MD5 77fe4d4a9b8f906b991cad2a97930cde
BLAKE2b-256 efbddf66cd2859f92b2e5960f31915c9289ec8bbfb1f7492aa9f557b1999c825

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page