--- id: schemainspect version: "3.1.1663587362" license: Unlicense license_treatment: permissive maintenance: dormant --- # schemainspect — Schema inspection for PostgreSQL (and possibly others) License: permissive · Maintenance: dormant · Downloads: 247.9K/mo ## What it is and what it does Schemainspect is a Python library that reads the structure of a PostgreSQL database and exposes it as Python objects through a SQLAlchemy connection. It introspects tables, views, materialized views, constraints, indexes, sequences, enums, functions, and extensions, including support for table partitioning and inheritance. You pass it an open SQLAlchemy session or connection and receive an inspector object with dictionary-like attributes mapping fully-qualified database object names to information objects. The library is designed for developers who need programmatic access to database schema metadata—for instance, to generate documentation, validate schema changes, or build schema-aware tools. It depends only on sqlalchemy and installs with low friction. The package is dormant but stable; it has no known vulnerabilities and supports Python 3.7 through 3.10. Use it for: - Extract table and column metadata from a PostgreSQL database to generate schema documentation or diagrams. - Validate database schema changes by comparing inspector snapshots before and after migrations. - Build schema-aware code generators or ORM mappers that need to introspect the live database structure. - Audit database objects like functions, constraints, and indexes programmatically in a Python application. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Inspects PostgreSQL database schemas to extract metadata about tables, views, indexes, constraints, functions, and other database objects through a SQLAlchemy connection. Yes, if you need to inspect a PostgreSQL schema programmatically. The package is dormant but stable, has no vulnerabilities, and installs cleanly with only sqlalchemy as a dependency. The main caveat is that it is no longer actively maintained; if you encounter bugs or need support for new PostgreSQL features, you may need to fork or patch it yourself. ## Install pip install schemainspect uv add schemainspect poetry add schemainspect ## Installing schemainspect Before you install: Low install friction with a single runtime dependency on sqlalchemy. The package is dormant (last release 2022-09-19, last commit 2024-05-14), so maintenance is not active, but the repository remains public and unarchived. License in practice: Licensed under the Unlicense (permissive), which places the work in the public domain with minimal restrictions on use or modification. Quickstart: from schemainspect import get_inspector from sqlalchemy import create_engine engine = create_engine('postgresql://user:password@localhost/dbname') with engine.connect() as conn: inspector = get_inspector(conn) books = inspector.tables['"public"."books"'] print(books.name, [col.name for col in books.columns]) Requires a running PostgreSQL database and a valid connection string; psycopg2 (PostgreSQL driver) must be installed separately or via the [pg] extra. Verify before relying: - Whether function inspection works reliably with languages other than SQL/PLPGSQL despite the stated limitation. - Current state of support for database systems other than PostgreSQL, given the 'potentially others in the future' language in the description. ## Package facts - License: Unlicense (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 247.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags postgresql schema inspection, database metadata extraction, sql schema analysis, table structure introspection, postgres schema explorer, schema-introspection, postgresql [View on SkillFed](https://skillfed.io/packages/schemainspect) · [View on PyPI](https://pypi.org/project/schemainspect/)