schemainspect: SQL Schema Inspection
Schema inspection for PostgreSQL (and potentially others in the future).
Inspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions. Handles table partitioning and inheritance.
Limitations: Function inspection only confirmed to work with SQL/PLPGSQL languages so far.
Basic Usage
Get an inspection object from an already opened SQLAlchemy session or connection as follows:
from schemainspect import get_inspector
from sqlbag import S
with S('postgresql:///example') as s:
i = get_inspector(s)
The inspection object has attributes for tables, views, and all the other things it tracks. At each of these attributes you'll find a dictionary (OrderedDict) mapping from fully-qualified-and-quoted-name-of-thing-in-database to information object.
For instance, the information about a table books would be accessed as follows:
>>> books_table = i.tables['"public"."books"']
>>> books_table.name
'books'
>>> books_table.schema
'public'
>>> [each.name for each in books_table.columns]
['id', 'title', 'isbn']
Documentation
Documentation is a bit patchy at the moment. Watch this space!
Author Credits
Initial development, maintenance:
Contributions:
Install
Install with pip:
$ pip install schemainspect
To install psycopg2 (the PostgreSQL driver) at the same time as well:
$ pip install schemainspect[pg]
Metadata
Release files for schema-inspect-maintained 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| schema_inspect_maintained-1.2.0.tar.gz | 28.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| schema_inspect_maintained-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.9 kB
Release files / schema_inspect_maintained-1.2.0.tar.gz
| Download URL | schema_inspect_maintained-1.2.0.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b896860dd7c5e377b419e351666b29c223ba0171c55718f54740d4a8a1fdba7
|
|
BLAKE2b-256 checksum How to use checksums |
fa80370bcf3f6bd720b8b0187d6df4ce35189cdec9c7b5fa95643bd4e5f3bccd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2025.
Transparency logRelease files / schema_inspect_maintained-1.2.0-py3-none-any.whl
| Download URL | schema_inspect_maintained-1.2.0-py3-none-any.whl |
|---|---|
| Size | 39.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e76dcc6124ed7d03ee5d7bb40ccc45d1e0c5b2df9b8bbeb4ffbf25451f7741d
|
|
BLAKE2b-256 checksum How to use checksums |
6d1371b149840ebf76f7a6e434806c314750d5d57606cdc13ea78776ff2f5ca8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 5, 2025.
Transparency log