
Metabase Database Metadata
- 367 installs
- 38 repo stars
- Updated June 5, 2026
- metabase/agent-skills
Equip coding agents with Metabase database metadata so they can answer schema questions, draft SQL, and wire BI dashboards without manual catalog lookups.
About
Metabase database metadata skill from metabase/agent-skills gives agents structured access to connected database catalogs inside Metabase. It helps teams build analytics features faster by grounding SQL, API, and dashboard work in real table and field definitions instead of guesswork.
- Surfaces Metabase-connected database schemas to agents
- Reduces wrong-table SQL and broken dashboard assumptions
- Bridges BI layer metadata with coding workflows
- Supports analytics-heavy SaaS and internal data products
Metabase Database Metadata by the numbers
- 367 all-time installs (skills.sh)
- +20 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #156 of 911 Databases skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/metabase/agent-skills --skill metabase-database-metadataAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 367 |
|---|---|
| repo stars | ★ 38 |
| Last updated | June 5, 2026 |
| Repository | metabase/agent-skills ↗ |
What it does
Equip coding agents with Metabase database metadata so they can answer schema questions, draft SQL, and wire BI dashboards without manual catalog lookups.
Files
Metabase Database Metadata Format
Metabase represents database metadata — synced databases, their tables, and their fields — as a tree of YAML files. Files are diff-friendly: numeric IDs are omitted entirely, and foreign keys use natural-key tuples like ["Sample Database", "PUBLIC", "ORDERS"] instead of database identifiers.
The format is defined by a specification bundled alongside this file as spec.md (upstream source: metabase/database-metadata). The same project ships a CLI (@metabase/database-metadata on npm) that converts the raw JSON exported from a Metabase instance into the YAML tree described by the spec.
Canonical layout
All metadata for a project lives under a top-level .metadata/ directory:
- `.metadata/databases/` — the YAML tree. This is the canonical source for the agent. Read these files to understand the schema, columns, types, and FK relationships.
- `.metadata/table_metadata.json` — the raw JSON exported from the Metabase instance. Potentially multi-megabyte (or multi-gigabyte) JSON with flat
databases/tables/fieldsarrays. Never open, grep, or pass it to tools. It exists only as input to the extractor.
The .metadata/ directory should be gitignored. On large warehouses the extracted metadata can reach gigabytes — committing it would make the repo painful or unusable.
First-time setup
Do not run any of the steps below proactively at session start. Only run them when the user explicitly asks to fetch metadata, set up the workflow, or requests something that plainly requires knowledge of the database schema (e.g. "write a query against ORDERS", "describe what tables exist").
When setup is triggered:
1. Ensure .metadata/ is gitignored
Read the repo's .gitignore and confirm .metadata/ is listed. If it isn't, ask the user before modifying `.gitignore` — e.g.:
.metadata/is not in.gitignore. Committing it would bloat the repo (metadata can be gigabytes). Shall I add it?
Only edit .gitignore after the user confirms.
2. Export the metadata from Metabase
Fetch table_metadata.json by calling POST /api/ee/serialization/metadata/export on the Metabase instance and writing the response to .metadata/table_metadata.json. The endpoint accepts three boolean query parameters that opt sections in or out — they all default to false, so requests must explicitly set the sections they want:
with-databases— include thedatabasesarray.with-tables— include thetablesarray.with-fields— include thefieldsarray.
A typical full export sets all three to true. The user supplies the base URL and an API key (e.g. via METABASE_URL and METABASE_API_KEY env vars):
mkdir -p .metadata
curl -sf -X POST "$METABASE_URL/api/ee/serialization/metadata/export?with-databases=true&with-tables=true&with-fields=true" \
-H "X-API-Key: $METABASE_API_KEY" \
-o .metadata/table_metadata.jsonIf the user has not provided credentials, ask for them before running the call.
3. Extract
Once .metadata/table_metadata.json is in place:
rm -rf .metadata/databases
npx @metabase/database-metadata extract-table-metadata .metadata/table_metadata.json .metadata/databasesThen read the YAML tree under .metadata/databases/ to answer the user's question.
Session start behaviour
At the start of a session, do not run any fetch commands. Just observe what's on disk:
- If
.metadata/table_metadata.jsonand.metadata/databases/both exist, assume the tree is sufficiently up to date and use it directly. Do not refetch. - If the tree is missing or only partial, do nothing until the user asks for something that needs it — then fall into the first-time-setup flow above.
If something in the tree looks stale or inconsistent while you're using it, mention it to the user and let them decide whether to refetch. Never refresh silently.
Refreshing (user-initiated only)
If the user explicitly asks to refresh metadata, re-run the export call to overwrite .metadata/table_metadata.json, then re-run the extract step. Always remove .metadata/databases before re-extracting so stale files are not left behind.
Entities
Three entity types, two file types:
| Entity | File | Description |
|---|---|---|
| Database | .metadata/databases/{db}/{db}.yaml | A connected data source (Postgres, MySQL, BigQuery, etc.). Identified by name. |
| Table | .metadata/databases/{db}/schemas/{schema}/tables/{table}.yaml (or .../tables/{table}.yaml for schemaless DBs) | A physical table or view. Contains a fields array with all its columns nested inline. |
| Field | (nested inside a Table YAML, no separate file) | A column. Includes base_type, database_type, and optionally effective_type, semantic_type, coercion_strategy, parent_id, fk_target_field_id. |
Foreign keys
Foreign keys use natural-key tuples, not numeric IDs:
- Database FK: the database name (string) — e.g.
"Sample Database" - Table FK:
[database, schema_or_null, table]— e.g.["Sample Database", "PUBLIC", "ORDERS"] - Field FK:
[database, schema_or_null, table, field, ...nested_field_names]— e.g.["Sample Database", "PUBLIC", "EVENTS", "DATA", "user", "name"]for a JSON-unfolded columnDATA.user.name
Field-level FKs show up as parent_id (nested field parent) and fk_target_field_id (referenced PK for FK columns).
Type attributes on fields
- `database_type` — the raw native type string from the driver (
BIGINT,VARCHAR,JSONB, etc.). Database-specific. - `base_type` — the Metabase type matching the native type (
type/BigInteger,type/Text,type/Structured, etc.). - `effective_type` — the type Metabase treats the column as at query time. Only emitted when it differs from
base_type(i.e. coercion is configured). - `coercion_strategy` — the rule producing
effective_typefrombase_type(e.g.Coercion/ISO8601->DateTime,Coercion/UNIXMilliSeconds->DateTime). - `semantic_type` — business-domain label (
type/PK,type/FK,type/Email,type/Category,type/Latitude, etc.). Drives UI and some analytical behavior.
See the bundled spec for the full type hierarchy and available coercion strategies.
Reading the spec
This skill ships with a local snapshot of the spec as spec.md, alongside SKILL.md.
Read it on demand, not eagerly. Open spec.md only when you actually need detail beyond what SKILL.md summarizes — e.g. the full base-type / semantic-type hierarchy, the complete list of coercion strategies, or the exact folder-path rules. Do not open it at session start, and do not open it for tasks unrelated to the metadata tree.
If the bundled copy looks out of date with the upstream package, the skill's own README.md documents how to refresh it with extract-spec.
metabase-database-metadata (skill)
This skill ships a local snapshot of the Metabase Database Metadata specification as spec.md, sitting next to SKILL.md. The SKILL references that bundled file directly, so an agent loading this skill never has to fetch the spec on its own.
Refreshing the bundled spec
When the upstream format changes, refresh the bundled copy by running this from inside the skill folder:
npx @metabase/database-metadata extract-spec --file ./spec.mdCommit the regenerated spec.md alongside SKILL.md.
Files
SKILL.md— the skill itself. Read by the agent.spec.md— the v1 specification of the Metabase Database Metadata Format. Agent reads this on demand when it needs details beyond whatSKILL.mdsummarizes (full type hierarchy, coercion strategies, exact folder-path rules, etc.).
Metabase Database Metadata Format
Version: 1.0.0
Overview
Metabase database metadata is a read-only snapshot of databases, tables, and fields that have been synced from a connected data source. This specification describes the default format for exporting that metadata to disk: one YAML file per database, and one YAML file per table with its fields nested inside.
The format is designed to be portable and reviewable: numeric IDs are omitted or replaced with human-readable natural keys (database name, [database, schema, table] tuples, etc.). Files can be diffed, grepped, and edited by hand.
The raw table_metadata.json is a single flat JSON document with databases, tables, and fields arrays, optimized for transport rather than reading. It can be arbitrarily large — tens or hundreds of megabytes on warehouses with many tables — and is not intended for direct consumption. Tools and humans should read the extracted YAML tree under databases/ instead, where each entity lives in its own small file.
Table of Contents
1. Entity Keys 2. Field Types 3. Folder Structure 4. Database 5. Table 6. Field
---
Entity Keys
Database objects are referenced using natural keys instead of numeric IDs.
| Reference | Format | Example |
|---|---|---|
| Database FK | database name | "Sample Database" |
| Table FK | [database, schema, table] | ["Sample Database", "PUBLIC", "ORDERS"] |
| Field FK | [database, schema, table, field, ...] | ["Sample Database", "PUBLIC", "ORDERS", "TOTAL"] |
For schemaless databases, the schema component is null (e.g., ["My Database", null, "my_table"]).
For JSON-unfolded fields, the Field FK extends beyond 4 elements with the nested path: ["Sample Database", "PUBLIC", "EVENTS", "DATA", "user", "name"] represents the JSON path DATA.user.name.
Numeric primary keys (id) are not emitted. Each entity is identified by its position in the folder tree and by the natural-key foreign keys on child entities.
---
Field Types
Each field has four type attributes that describe the column at different layers: database_type (the native SQL type), base_type (the matching Metabase type), effective_type (the type after any coercion), and semantic_type (the business-domain role). An optional coercion_strategy defines the rule that produces effective_type from base_type.
database_type
The native SQL type reported by the database driver, verbatim (e.g., BIGINT, VARCHAR, DOUBLE PRECISION, TIMESTAMP WITH TIME ZONE, JSONB). This value is database-specific: the same logical type can appear with different spellings across engines (INT4 vs INTEGER, CHARACTER VARYING vs VARCHAR, DOUBLE vs DOUBLE PRECISION). Metabase uses database_type for informational purposes and when generating native SQL; it is not portable across engines.
database_type always maps deterministically to a base_type for a given driver — see the table below for typical pairings.
base_type
The raw Metabase type that matches the column's native database type. This is what the driver reports the column as (e.g., a Postgres BIGINT → type/BigInteger, VARCHAR → type/Text, DOUBLE PRECISION → type/Float).
base_type is always one of the types below and never a semantic type like type/PK.
Common base types (selected from the type hierarchy):
| Base type | Meaning | Typical native types |
|---|---|---|
type/Boolean | Boolean | BOOLEAN, BIT |
type/Integer | Signed integer | INTEGER, INT, SMALLINT |
type/BigInteger | Wide integer | BIGINT |
type/Float | Binary floating-point | DOUBLE, REAL, FLOAT |
type/Decimal | Fixed-precision decimal | DECIMAL, NUMERIC |
type/Text | Variable-length text | VARCHAR, TEXT, CHARACTER |
type/UUID | UUID (a type/Text subtype) | UUID |
type/Date | Date without time | DATE |
type/Time | Time of day | TIME |
type/TimeWithLocalTZ | Time stored at UTC | TIME WITH TIME ZONE |
type/DateTime | Local date-time (no offset) | TIMESTAMP, DATETIME |
type/DateTimeWithLocalTZ | Date-time stored at UTC | TIMESTAMP WITH TIME ZONE |
type/Instant | Absolute point in time | (see coercion strategies) |
type/Structured | JSON/structured payload | JSON, JSONB |
type/* | Unknown / fallback | — |
effective_type
The type Metabase actually treats the column as when running queries. If no coercion is applied, effective_type equals base_type and is omitted from the YAML. It is emitted only when coercion changes the type.
For example: a VARCHAR column whose base_type is type/Text but that stores ISO-8601 timestamps would have effective_type: type/DateTime and coercion_strategy: Coercion/ISO8601->DateTime.
coercion_strategy
An optional rule that tells Metabase how to convert base_type → effective_type at query time. Absent unless coercion is configured.
Built-in coercion strategies:
| Strategy | base_type | effective_type |
|---|---|---|
Coercion/UNIXSeconds->DateTime | type/Integer, type/Decimal | type/Instant |
Coercion/UNIXMilliSeconds->DateTime | type/Integer, type/Decimal | type/Instant |
Coercion/UNIXMicroSeconds->DateTime | type/Integer, type/Decimal | type/Instant |
Coercion/UNIXNanoSeconds->DateTime | type/Integer, type/Decimal | type/Instant |
Coercion/ISO8601->Date | type/Text | type/Date |
Coercion/ISO8601->Time | type/Text | type/Time |
Coercion/ISO8601->DateTime | type/Text | type/DateTime |
Coercion/YYYYMMDDHHMMSSString->Temporal | type/Text | type/DateTime |
Coercion/DateTime->Date | type/DateTime | type/Date |
semantic_type
An optional label describing how the column is used in the business domain. Semantic types sit in a separate hierarchy (rooted at Semantic/* or Relation/*) and don't affect how values are read or converted — they drive UI choices (icons, default visualizations, filter widgets) and some analytical behavior (e.g., auto-binning for type/Category).
Common semantic types, grouped by purpose:
| Group | Semantic types |
|---|---|
| Relations | type/PK, type/FK |
| Identity / labels | type/Name, type/Title, type/Description, type/Comment |
| Categorization | type/Category, type/Enum, type/Source, type/Product, type/Company, type/Subscription |
| Geography | type/City, type/State, type/Country, type/ZipCode, type/Latitude, type/Longitude, type/IPAddress |
| Contact | type/Email, type/URL, type/ImageURL, type/AvatarURL |
| Money / numeric | type/Currency, type/Price, type/Cost, type/Income, type/Discount, type/GrossMargin, type/Percentage, type/Share, type/Score, type/Quantity, type/Duration |
| Temporal roles | type/CreationTimestamp, type/CreationDate, type/JoinTimestamp, type/CancelationTimestamp, type/DeletionTimestamp, type/UpdatedTimestamp, type/Birthdate |
| Other | type/User, type/Structured |
semantic_type is always compatible with effective_type (or base_type when no coercion is in play) — e.g., type/Latitude only makes sense on type/Float, type/Email only on type/Text.
---
Folder Structure
By convention, metadata is extracted under a .metadata/databases/ directory, with each database occupying its own folder. The exporter itself doesn't enforce this location; it writes the tree below into whatever folder the caller passes.
.metadata/
└── databases/
└── {database}/
├── {database}.yaml
├── schemas/
│ └── {schema}/
│ └── tables/
│ └── {table}.yaml
└── tables/ # Schemaless databases
└── {table}.yamlPath Construction Rules
- Database, schema, and table names are used verbatim as folder and file names. Case and spaces are preserved (e.g.
Sample Database/,PUBLIC/,ORDERS.yaml). - Only characters that are invalid in paths are escaped:
/becomes__SLASH__,\becomes__BACKSLASH__. - A database's YAML file (
{name}.yaml) lives at the root of its folder. - Tables are nested under
schemas/{schema}/tables/{table}.yamlwhen the database has schemas, or directly undertables/{table}.yamlfor schemaless databases. - A table's YAML file embeds all of its fields inline — there is no separate file per field.
---
Database
A Database entry describes a connected data source (e.g., a Postgres or MySQL instance). Only identifying information is included; connection details are not part of this format.
The database YAML file lives at databases/{slug}/{slug}.yaml.
Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Database name (unique, used as the Database FK) |
engine | string | Yes | Database engine (e.g., postgres, mysql, h2, bigquery-cloud-sdk) |
Example
name: Sample Database
engine: postgres---
Table
A Table entry describes a single physical table (or view) within a database. Its fields are nested directly in the same YAML file.
The table YAML file lives at databases/{db_slug}/schemas/{schema_slug}/tables/{table_slug}.yaml (or databases/{db_slug}/tables/{table_slug}.yaml for schemaless databases).
Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Table name in the database |
db_id | string | Yes | Database FK (database name) |
fields | array | Yes | Array of Field entries belonging to this table |
schema | string | No | Schema name; omitted for schemaless databases |
description | string | No | Human-readable description |
Example
name: ORDERS
db_id: Sample Database
schema: PUBLIC
description: Confirmed Sample Company orders for a product, from a user.
fields:
- name: ID
base_type: type/BigInteger
database_type: BIGINT
semantic_type: type/PK
- name: TOTAL
description: The total billed amount.
base_type: type/Float
database_type: DOUBLE PRECISION---
Field
A Field entry describes a single column. Fields are nested inline inside their Table; there is no separate field file.
A field's table is implied by its position in the enclosing table's fields array, so table_id is not emitted on nested fields. Only parent_id appears when the field is a child of another field (e.g., JSON-unfolded nested columns).
Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Column name in the database |
database_type | string | Yes | Native database type (e.g., INTEGER, VARCHAR) |
base_type | string | Yes | Metabase type matching the native type. See Field Types |
description | string | No | Human-readable description |
effective_type | string | No | Type after coercion; omitted when equal to base_type. See Field Types |
coercion_strategy | string | No | Coercion rule applied at query time. See Field Types |
semantic_type | string | No | Business-domain label (e.g., type/PK, type/Email). See Field Types |
parent_id | array | No | Field FK of the parent field, for nested/JSON-unfolded columns |
fk_target_field_id | array | No | Field FK of the referenced primary-key column, for fields with semantic_type: type/FK |
Example
name: CREATED_AT
description: The order creation timestamp.
base_type: type/Text
database_type: TEXT
effective_type: type/DateTime
semantic_type: type/CreationTimestamp
coercion_strategy: Coercion/ISO8601->DateTimeNested Fields
JSON-unfolded columns use parent_id to reference the enclosing field:
name: name
base_type: type/Text
database_type: TEXT
parent_id:
- Sample Database
- PUBLIC
- EVENTS
- DATA
- user