Metadata-Version: 2.0
Name: sqliteschema
Version: 0.6.0
Summary:     sqliteschema is a python library to dump table schema of a SQLite database
    file.
    
Home-page: https://github.com/thombashi/sqliteschema
Author: Tsuyoshi Hombashi
Author-email: gogogo.vm@gmail.com
License: MIT License
Keywords: SQLite,library,schema
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: DataProperty (>=0.14.0)
Requires-Dist: SimpleSQLite (>=0.7.1)
Requires-Dist: pytablewriter (>=0.16.0)
Requires-Dist: six

sqliteschema
===============

.. image:: https://badge.fury.io/py/sqliteschema.svg
    :target: https://badge.fury.io/py/sqliteschema

.. image:: https://img.shields.io/pypi/pyversions/sqliteschema.svg
    :target: https://pypi.python.org/pypi/sqliteschema

.. image:: https://img.shields.io/travis/thombashi/sqliteschema/master.svg?label=Linux
    :target: https://travis-ci.org/thombashi/sqliteschema

.. image:: https://img.shields.io/appveyor/ci/thombashi/sqliteschema/master.svg?label=Windows
    :target: https://ci.appveyor.com/project/thombashi/sqliteschema/branch/master

.. image:: https://coveralls.io/repos/github/thombashi/sqliteschema/badge.svg?branch=master
    :target: https://coveralls.io/github/thombashi/sqliteschema?branch=master


Summary
=======
Python library to dump table schema of a SQLite database file.


Installation
============

::

    pip install sqlitestructure


Usage
=====

.. code:: python

    for verbosity_level in range(6):
        print("===== verbosity level {} =====".format(verbosity_level))
        extractor = sqliteschema.SqliteSchemaExtractor(db_path, verbosity_level)
        print(extractor.dumps())


.. code::

    ===== verbosity level 0 =====
    sampletable0
    sampletable1
    sampletable2

    ===== verbosity level 1 =====
    sampletable0 ("attr_a", "attr_b")
    sampletable1 (foo, bar, hoge)
    sampletable2 (abc, efg)

    ===== verbosity level 2 =====
    sampletable0 ("attr_a" INTEGER, "attr_b" INTEGER)
    sampletable1 (foo INTEGER, bar REAL, hoge TEXT)
    sampletable2 (abc INTEGER, efg REAL)

    ===== verbosity level 3 =====
    sampletable0 ("attr_a" INTEGER, "attr_b" INTEGER)
    sampletable1 (foo INTEGER, bar REAL, hoge TEXT)
    sampletable2 (abc INTEGER PRIMARY KEY, efg REAL NOT NULL)

    ===== verbosity level 4 =====
    sampletable0 (
        "attr_a" INTEGER,
        "attr_b" INTEGER
    )
    sampletable1 (
        foo INTEGER,
        bar REAL,
        hoge TEXT
    )
    sampletable2 (
        abc INTEGER PRIMARY KEY,
        efg REAL NOT NULL
    )

    ===== verbosity level 5 =====
    sampletable0 (
        "attr_a" INTEGER,
        "attr_b" INTEGER
    )

    sampletable1 (
        foo INTEGER,
        bar REAL,
        hoge TEXT
    )
        CREATE INDEX sampletable1_foo_index ON sampletable1('foo')
        CREATE INDEX sampletable1_hoge_index ON sampletable1('hoge')
    sampletable2 (
        abc INTEGER PRIMARY KEY,
        efg REAL NOT NULL
    )


Full example can be found at examples/get_table_schema.py


Dependencies
============

Python 2.7+ or 3.3+

- `DataPropery <https://github.com/thombashi/DataProperty>`__
- `SimpleSQLite <https://github.com/thombashi/SimpleSQLite>`__
- `six <https://pypi.python.org/pypi/six/>`__

Test dependencies
-----------------

-  `pytest <https://pypi.python.org/pypi/pytest>`__
-  `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`__
-  `tox <https://pypi.python.org/pypi/tox>`__


