All Projects → husio → python-sqlite3-backup

husio / python-sqlite3-backup

Licence: other
Sqlite3 online API CPython implementation module

Programming Languages

c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-sqlite3-backup

Pydbgen
Random dataframe and database table generator
Stars: ✭ 191 (+334.09%)
Mutual labels:  sqlite, sqlite3
Mikro Orm
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.
Stars: ✭ 3,874 (+8704.55%)
Mutual labels:  sqlite, sqlite3
Better Sqlite3
The fastest and simplest library for SQLite3 in Node.js.
Stars: ✭ 2,778 (+6213.64%)
Mutual labels:  sqlite, sqlite3
Rom Sql
SQL support for rom-rb
Stars: ✭ 169 (+284.09%)
Mutual labels:  sqlite, sqlite3
laravel-database-manager
Make your database simple, easier and faster with vuejs.
Stars: ✭ 50 (+13.64%)
Mutual labels:  backup, sqlite3
Sqlittle
Pure Go SQLite file reader
Stars: ✭ 171 (+288.64%)
Mutual labels:  sqlite, sqlite3
Sqleet
SQLite3 encryption that sucks less
Stars: ✭ 244 (+454.55%)
Mutual labels:  sqlite, sqlite3
Sqhell.vim
An SQL wrapper for vim
Stars: ✭ 113 (+156.82%)
Mutual labels:  sqlite, sqlite3
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (+170.45%)
Mutual labels:  backup, sqlite
Bareos
Main repository with the code for the libraries and daemons
Stars: ✭ 651 (+1379.55%)
Mutual labels:  backup, sqlite
react-native-quick-sqlite
Fast SQLite for react-native.
Stars: ✭ 239 (+443.18%)
Mutual labels:  sqlite, sqlite3
go-sqlite
Low-level Go interface to SQLite 3
Stars: ✭ 268 (+509.09%)
Mutual labels:  sqlite, sqlite3
Sqlite Parquet Vtable
A SQLite vtable extension to read Parquet files
Stars: ✭ 167 (+279.55%)
Mutual labels:  sqlite, sqlite3
Choochoo
Training Diary
Stars: ✭ 186 (+322.73%)
Mutual labels:  sqlite, sqlite3
Esp32 arduino sqlite3 lib
Sqlite3 Arduino library for ESP32
Stars: ✭ 167 (+279.55%)
Mutual labels:  sqlite, sqlite3
React Native Sqlite 2
SQLite3 Native Plugin for React Native for iOS, Android, Windows and macOS.
Stars: ✭ 217 (+393.18%)
Mutual labels:  sqlite, sqlite3
Genomicsqlite
Genomics Extension for SQLite
Stars: ✭ 90 (+104.55%)
Mutual labels:  sqlite, sqlite3
Sqlite3 Encryption
The easiest way to build SQLite3 with encryption support on Windows. Compilation of DLL, SLL or shell is now a matter of minutes
Stars: ✭ 102 (+131.82%)
Mutual labels:  sqlite, sqlite3
Django Dbbackup
Management commands to help backup and restore your project database and media files
Stars: ✭ 471 (+970.45%)
Mutual labels:  backup, sqlite
LoginToASqlite3DatabaseWithoutCredentialsWithAdminer
✔️ An Adminer plugin to use SQLite databases without credentials (no username and no password)
Stars: ✭ 30 (-31.82%)
Mutual labels:  sqlite, sqlite3

sqlitebck

Build Status PyPI version License: MIT

Backup function is now provided by the standard library

SQLite3 backup function implementation for Python sqlite3 module

Single function that allows to copy content of one sqlite3 database to another one. You can use this for example for loading and dumping in memory database (:memory:) into a file (alternative to the iter dump functionality).

See the Sqlite3 C API docs for more information.

The same functionality is being provided by the apsw backup API, which provides more information about the copy process.

Build and installation

You can build or install sqlitebck using distutils:

$ python setup.py build
$ python setup.py install

You can also install it, using the pip command:

$ pip install sqlitebck

Tests

Test basic functionality (make sure you have build the sqlitebck module):

$ python tests.py

Usage example

Basic usage example - a memory database saved into a file:

>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> curr = conn.cursor()

Create a table and put there some data:

>>> curr.execute('CREATE TABLE foo (bar INTEGER)')
<sqlite3.Cursor object at 0xb73b2800>
>>> curr.execute('INSERT INTO foo VALUES (123)')
<sqlite3.Cursor object at 0xb73b2800>
>>> curr.close()
>>> conn.commit()
>>> import sqlitebck

Save a memory database (conn) into a file:

>>> conn2 = sqlite3.connect('/tmp/in_memory_sqlite_db_save.db')
>>> sqlitebck.copy(conn, conn2)
>>> conn.close()
>>> curr2 = conn2.cursor()

Check if data is in a file database:

>>> curr2.execute('SELECT * FROM foo');
<sqlite3.Cursor object at 0xb73b2860>
>>> curr2.fetchall()
[(123,)]

If you want to load a file database into a memory:

>>> sqlitebck.copy(conn2, conn)

If you want to copy a (large) online database, you can release the read-lock on the source database for a specified time between copying each batch of pages:

>>> sqlitebck.copy(conn2, conn, pages, sleep)

By default, pages=0 and sleep=0, which copies all pages with no interruption.

The online copying process handles situations with a write-lock on the source database and copying of changes written to the source database while copying batches of pages.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].