Introspection
Database Introspection
When you connect a data source, Monospace reads your database schema and maps it to your Data Model. Tables become collections, columns become fields, and foreign key constraints become relations.
If your database schema changes outside of Monospace, re-introspecting the data source will detect additions and removals.
What Gets Discovered
Monospace introspects the following database objects:
- Tables — mapped to collections
- Partitioned tables — mapped to a single collection representing the parent table; child partitions are excluded
- Views and materialized views — mapped to read-only collections
- Columns — mapped to fields, including nullability and default values
- Foreign key constraints — mapped to relations, including referential actions (cascade, set null, etc.)
- Indexes — primary keys, unique indexes, and regular indexes
- Schemas (PostgreSQL namespaces) — preserved as namespaces within the data source
Generated columns (GENERATED ALWAYS AS IDENTITY, GENERATED ALWAYS ... STORED) are detected and marked as read-only.
API Names
Every collection and field has an API name — the identifier you use in queries. A valid API name starts with a letter and contains only letters, digits, and underscores.
Introspection derives one from each source name: unicode is transliterated to ASCII, your workspace's naming convention is applied, and a leading digit is prefixed with n.
| Source name | API name (camelCase convention) |
|---|---|
café table | cafeTable |
straße | strasse |
2024 sales | n2024Sales |
The naming convention applies to introspection only. An API name you supply yourself — through the Studio or POST /api/{workspace}/schema/migrate — is validated but never rewritten to match the convention. An invalid one is rejected with a 422.
Existing API names are never renamed. The rule applies to names you create or edit.
What Is Not Introspected
The following database objects are not discovered during introspection:
- Check constraints
- Stored procedures, functions, and triggers
- Row-level security (RLS) policies
- Table and column comments
- Expression-based indexes
- Partial (conditional) indexes
- Exclusion constraints
Unsupported Column Types
Columns with types that Monospace does not support are still visible in the Data Model, but are excluded from the API — they cannot be queried, filtered, or written to.
The following PostgreSQL types are currently unsupported:
- Enum types
- Range types (
int4range,tsrange, etc.) - Composite / custom types
- Multi-dimensional arrays
money,interval- Geometric types (
point,line,box,polygon,circle, etc.) - Full-text search types (
tsvector,tsquery) xml- Network types (
macaddr,macaddr8)
For the complete mapping of supported database types to Monospace field types, see Type Support.
Known Limitations
Composite Foreign Keys
Composite foreign keys (constraints spanning multiple columns) are fully supported.
Self-Referencing Relations
Tables with foreign keys referencing themselves are fully supported.