Repository navigation
Warehouse PostgreSQL
The
postgresreader crawls one PostgreSQL database throughpg_catalog, giving tables, views, materialized views, foreign tables, columns, comments, row estimates, sizes and keys. It reads only system catalogs; no table data is scanned, and measurement probes run through FactLang like on every warehouse. Validated against a real PostgreSQL 16 server in CI (service container).
Reader: postgres (schemaguru.catalog.readers.postgres.PostgresReader). Extra:
pip install "schemaguru[postgres]" (driver psycopg 3). URLs postgresql://... and
postgres://... both map to this dialect. One database per connection, so refs carry no catalog:
schema.table.
pg_namespace, pg_class, pg_attribute, pg_attrdef, pg_constraint, pg_description
(comments via obj_description), pg_total_relation_size (bytes) and pg_get_partkeydef
(partitioning). Not information_schema, which hides objects the role cannot use and is slow on
large catalogs.
A role that can connect to the database. pg_catalog is readable by every role; nothing is
written. Measurement probes need SELECT on the tables you measure, so give SchemaGuru a
read-only role (for example one granted pg_read_all_data on PostgreSQL 14+, or SELECT on the
schemas you care about).
Catalog queries only, one per page of tables and one per batch of up to 200 tables for columns and constraints. They are cheap even on catalogs with many thousands of relations.
- Kinds: ordinary and partitioned tables (
table), views, materialized views, foreign tables (external). Partitions themselves (relispartition) are not listed separately; the parent carries the partition key aspartitioning. - Comments on schemas, tables and columns.
-
row_countfrompg_class.reltuples, an estimate maintained byVACUUM/ANALYZE. A table that was never analysed (reltuples = -1, or no pages and no tuples) has an unknown row count, never 0. -
bytesfrompg_total_relation_size(table, indexes and TOAST). - Primary, unique and foreign keys (
enforced=True), composite keys in full, in key order. - Column defaults as expressions (
pg_get_expr); view column nullability is unknown.
-
No incremental listing and no
last_altered: PostgreSQL keeps no per-table modification time in the catalog, so every crawl re-lists every table (still metadata only). - Schemas
information_schemaandpg_*are skipped; the crawl's default excludes addpg_catalog.*. - Run
ANALYZEbefore crawling if you want row estimates for freshly loaded tables. - Names are returned exactly as stored (lower-case unless created quoted).
- Catalog-and-Crawl
- Warehouse-Redshift (a PostgreSQL-derived warehouse with its own reader)
- Store (the Postgres-backed store is a different thing: where SchemaGuru keeps its knowledge)
- Extending-CatalogReader
SchemaGuru is open source under the MIT License, Copyright (c) 2026 Rupak Chakraborty · Repository · Issues · This wiki is generated from docs/wiki/; edit it there, not here.
Start here
Components
- Catalog and Crawl
- Store
- Measurement
- Sampling
- Join Graph
- Path Search and Hub Guard
- Waypoint Rules
- Drafting
- PII and Sampling Policy
- Overlays
- Scoping
- Rendering
- Refresh and Drift
- Feedback and Guard
- Server
- Agent Integration
Using it
Warehouses
- BigQuery
- Snowflake
- Redshift
- Databricks
- PostgreSQL
- DuckDB
- ClickHouse
- SQL Server / Synapse
- Oracle
- Trino
- MySQL / MariaDB
Extending
- CatalogReader
- Store
- Retriever and Embedder
- TokenCounter
- LLMProvider
- PII Detector
- FailureClassifier
- FactKind
- Profile and Format
- ChangeClassifier
- JoinCandidateSource (planned)
- Authenticator
Project