sqlite-dump
An improved version of .iterdump() for Python's sqlite3
Background
Python's sqlite3 standard library module provides a method for dumping the contents of a database out as lines of SQL that can be used to recreate the database:
import sqlite3
conn = sqlite3.connect("mydb.db")
for line in conn.iterdump():
print(line)
This mechanism is convenient but unfortunately does not support every SQLite feature. In particular it doesn't correctly dump databases that use SQLite's full-text search functionality from the FTS module. This library offers an improved alternative to the .iterdump() method.
Installation
Install this plugin using pip:
$ pip install sqlite-dump
Usage
To loop through lines of SQL that can recreate a SQLite database file:
import sqlite3
from sqlite_dump import iterdump
conn = sqlite3.connect(db_path)
for line in iterdump(conn):
print(line)
Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd sqlite-dump
python -mvenv venv
source venv/bin/activate
Or if you are using pipenv:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
Release files for sqlite-dump 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlite-dump-0.1.1.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlite_dump-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / sqlite-dump-0.1.1.tar.gz
| Download URL | sqlite-dump-0.1.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1801d27da369e4d90efe3fb3327adcad7b4efe5686543ad5aeb518a45341c57a
|
|
BLAKE2b-256 checksum How to use checksums |
03afa96711d5c8957652f3700377705c280158ea6ebbf419562fd2bfea90d092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|
Release files / sqlite_dump-0.1.1-py3-none-any.whl
| Download URL | sqlite_dump-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd3083e76f4aa907c824b5af531f58cabe97e3cb865383a4f84c2aa2cf7257a9
|
|
BLAKE2b-256 checksum How to use checksums |
0f53fa674d7e4ab4794dbbfee55f3e97479ded74669752c776dac0f3bb886bfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|