Skip to main content

A tool to copy sqlite databases you don't own

Project description

WORK IN PROGRESS

The core here is my first attempt at a solution of this, combining ideas from browser_history.py and karlicoss/HPI/sqlite.py to attempt to create a library/CLI tool to (as safely as possible) copy databases which may be in use from other applications.

sqlite_backup

This exposes the python stdlib sqlite.backup function as a library, with a couple extra steps.

The main purpose for writing this is to copy sqlite databases that you may not own -- perhaps it belongs to an application (your browser) and is locked since that's currently open, or the OS keeps it open while the computer is active (e.g. Mac with iMessage)

Features

  • Has the option (true by default) to first atomically copy the database from disk to a temporary directory, which is:
    • useful case the source is in write-only mode
    • safer if you're especially worried about corrupting or losing data
  • Uses Cpythons conn.backup, which directly uses the underlying Sqlite C code

In short, this prioritizes safety of the data over speed or performance -- because we often don't know what the application may be doing while we're copying underlying sqlite databases

This was extracted out of the karlicoss/HPI sqlite module

If other tools exist to do this, please let me know!

Installation

Requires python3.7+

To install with pip, run:

pip install sqlite_backup

Usage

TODO: Fill this out

Usage: ...

Tests

git clone 'https://github.com/seanbreckenridge/sqlite_backup'
cd ./sqlite_backup
pip install '.[testing]'
mypy ./sqlite_backup
pytest

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

sqlite_backup-0.1.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

sqlite_backup-0.1.0-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

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