Fixed version from https://bitbucket.org/andialbrecht/python-dbschema
dbschema
is a Python module to inspect database schema definitions.
The module can be installed from the Python Package Index for example by running:
pip install dbschema
The module is compatible with Python 2.7, >=3.2 and PyPy. Depending on the database system you want to access a DB-API2 (249
) compliant driver is required.
The following example shows the basic usage of the dbschema
module:
pycon
>>> import dbschema >>> import psycopg2 # in this example we're using a PostgreSQL database >>> connection = psycopg2.connect(dbname='demo', user='john', password='doe') >>> schema = dbschema.open('postgresql', connection) >>> tables = schema.get_tables() >>> for table in schema.get_tables(): ... print(table.name) ... artist track artist_track_rel [โฆ] >>>
Continue with the tutorial to learn more about the database object.
dbschema is licensed under the BSD license.
- Documentation
- Bug tracker
- Source code