Skip to content

habeanf/python-dbschema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fixed version from https://bitbucket.org/andialbrecht/python-dbschema

python-dbschema

dbschema is a Python module to inspect database schema definitions.

Installation

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 (PEP 249) compliant driver is required.

Usage

The following example shows the basic usage of the dbschema module:

>>> 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.

License

dbschema is licensed under the BSD license.

Resources

Documentation
http://python-dbschema.readthedocs.org/en/latest/
Bug tracker
https://bitbucket.org/andialbrecht/python-dbschema/issues
Source code
https://bitbucket.org/andialbrecht/python-dbschema