Metadata-Version: 1.1
Name: sqlitebck
Version: 1.2
Summary: Sqlite3 online backup API implementation.
Home-page: https://github.com/husio/python-sqlite3-backup
Author: Piotr Husiatyński
Author-email: phusiatynski@gmail.com
License: MIT
Download-URL: https://github.com/husio/python-sqlite3-backup/tarball/master#egg=sqlitebck-1.2
Description: Sqlite3 backup function implementation for Python sqlite3 module
        ================================================================
        
        Single function that allows to save any sqlite3 database one to another. You
        can use this for example for loading and dumping memory database (`:memory:`)
        into file (alternative to `iter dump`_ functionality).
        
        See the `Sqlite3 C API docs`_ for more info.
        
        The same functionality is being provided by the `apsw backup`_ API, which
        provides even more information about the copy process.
        
        .. _iter dump: http://docs.python.org/release/2.6/library/sqlite3.html#sqlite3.Connection.iterdump
        .. _Sqlite3 C API docs: http://www.sqlite.org/c3ref/backup_finish.html
        .. _apsw buckup: http://apidoc.apsw.googlecode.com/hg/backup.html
        
        
        Build and installation
        ----------------------
        
        Now you can build or install `sqlitebck` using distutils::
        
        
            $ python setup.py build
            $ python setup.py install
        
        
        You can also intsall it, using the `pip` command::
        
        
            $ pip install sqlitebck
        
        
        
        
        Tests
        -----
        
        Nothing big, just test basic functionality (make sure you have build the
        `sqlitebck` module)::
        
            $ python tests.py
        
        
        Usage example
        -------------
        
        Basic usage example - memory database saved into file::
        
        
            >>> import sqlite3
            >>> conn = sqlite3.connect(':memory:')
            >>> curr = conn.cursor()
        
        
        Create 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 in memory database (conn) into 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 file database::
        
        
            >>> curr2.execute('SELECT * FROM foo');
            <sqlite3.Cursor object at 0xb73b2860>
            >>> curr2.fetchall()
            [(123,)]
        
        
        If you want to load file database into memory, just call::
        
        
            >>> sqlitebck.copy(conn2, conn)
        
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
