extractor Package
Theextractor package queries PostgreSQL system catalogs to build a complete schema representation.
Extractor
Main type for schema extraction.Options
Extract
Extracts the complete database schema.- Schemas
- Extensions
- Custom Types
- Sequences
- Tables (with columns, constraints)
- Indexes
- Views
- Materialized Views
- Functions
- Triggers
- Hypertables (if TimescaleDB)
- Continuous Aggregates (if TimescaleDB)
Example Usage
System Schema Exclusion
These schemas are excluded by default:| Category | Schemas |
|---|---|
| PostgreSQL | pg_catalog, information_schema, pg_toast |
| TimescaleDB | _timescaledb_cache, _timescaledb_catalog, _timescaledb_config, _timescaledb_internal, timescaledb_information, timescaledb_internal |
| Hasura | hdb_catalog |
Internal Extraction Methods
Tables
pg_class- Table metadatapg_attribute- Column definitionspg_constraint- Constraintspg_attrdef- Default values
Indexes
pg_index- Index metadatapg_class- Index propertiespg_am- Access method (btree, hash, etc.)
Functions
pg_proc- Function definitionspg_type- Argument and return typespg_language- Implementation language
TimescaleDB
timescaledb_information.hypertablestimescaledb_information.dimensionstimescaledb_information.compression_settingstimescaledb_information.continuous_aggregates
Error Handling
Extraction errors are wrapped with context:Performance Considerations
- Single database connection used throughout extraction
- Queries are optimized to minimize round trips
- Large databases (1000+ tables) may take 30-60 seconds
- Context timeout should be set appropriately (default: 5 minutes)
See Also
- schema Package - Data model definitions
- Schema Extraction - Concept documentation
extractcommand - CLI reference