An improved version of .iterdump() for sqlite3
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sqlite_dump-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38dc5b3485e65859d1dc7a26ddb8bab7b7d602e97b8a11d5ced765138c073650 |
|
MD5 | 092f4c73e37891f8245a762af19ea415 |
|
BLAKE2b-256 | b239e229d84485e378518b700e8b7e03fd74ec78a2a2f139b9f0509a5285d522 |