auditing-skills
Use when checking skills for security or quality issues, reviewing audit results from…
Use when answering questions about a dbt v2 project's own metadata — which models, sources, tests, columns, configs, tags, packages or lineage exist, what is untested or undocumented, what depends on what, how long models took in the last run — or when using `dbt show --info`,
$ npx -y skills add dbt-labs/dbt-agent-skills --skill querying-the-dbt-information-schema --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/querying-the-dbt-information-schemaContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when answering questions about a dbt v2 project's own metadata — which models, sources, tests, columns, configs, tags, packages or lineage exist, what is untested or undocumented, what depends on what, how long models took in the last run — or when using `dbt show --info`,
name: querying-the-dbt-information-schema
description: Use when answering questions about a dbt v2 project's own metadata — which models, sources, tests, columns, configs, tags, packages or lineage exist, what is untested or undocumented, what depends on what, how long models took in the last run — or when using `dbt show --info`, `{{ info_schema() }}`, `--generate-info-schema`, `target/info_schema/`, or writing `dbt check` SQL. Prefer this over grepping YAML or parsing `manifest.json` on dbt v2.
user-invocable: false
metadata:
author: dbt-labsThe dbt Information Schema is a set of SQL views over your project's metadata: models, sources, tests, columns, DAG edges, configs, and run results. You query it with DuckDB SQL, locally, without touching the warehouse.
Use it to answer "what is in this project" questions with one SQL query, instead of grepping YAML or loading a 70 MB `manifest.json`.
| You want to… | Go to | |---|---| | Check the project can use this | [Prerequisites](#prerequisites) | | Answer a one-off question | [Route A: `dbt show`](#route-a-dbt-show-default) (default) | | Run many queries, script them, or use `run_results_latest` | [Route B: DuckDB on the parquet files](#route-b-duckdb-on-the-parquet-files) | | Avoid wrong answers from tricky columns | [Column gotchas](#column-gotchas) | | Understand why a view is empty | [What is populated when](#what-is-populated-when) | | Copy a working query | [Common queries](#common-queries) | | Enforce a rule on every build | [Turning a query into a check](#turning-a-query-into-a-check) |
**Which route?** Use `dbt show` unless you have a reason not to. It always reads the metadata from the latest dbt command, and it needs nothing installed. Switch to DuckDB when it is installed and you will run many queries, because each `dbt show` call costs about 0.6 s versus about 0.1 s for DuckDB. The trade-off is that you must refresh the parquet files yourself.
| | Route A: `dbt show` | Route B: DuckDB on parquet | |---|---|---| | Table names | `{{ info_schema('models') }}` (Jinja, bare view name) | `dbt.models`, `dbt_rt.run_results` (after `.read views.sql`), or `'dbt.models.parquet'` | | Freshness | Updated by `build`, `run`, `check` by default | Updated only by a command run with `--generate-info-schema` | | Needs | dbt v2 | dbt v2 once, plus the `duckdb` CLI or a parquet library | | `dbt_rt.run_results_latest` | Not available | Available | | Speed per query | ~0.2–0.7 s | ~0.1 s |
# List every available view (unknown names print the full list)
dbt show --info nonexistent
# One view, all rows, clean JSON on stdout
dbt show --quiet --info models --limit -1 --output json
# Ad-hoc SQL (DuckDB dialect)
dbt show --quiet --output json --limit -1 --inline "
select resource_type, count(*) n
from {{ info_schema('dag_nodes') }}
group by 1 order by 2 desc"
# Discover a view's columns yourself
dbt show --limit -1 --inline "describe select * from {{ info_schema('node_columns') }}"`--info <view>` is shorthand for `--inline "select * from {{ info_schema('<view>') }}"`. dbt runs the query on an embedded DuckDB, so you don't need to install DuckDB.
| Rule | Why | |---|---| | Put a **literal** `{{ info_schema('view') }}` call in every `--inline` query. | dbt routes the query to DuckDB only when the SQL contains a literal call. `info_schema(my_var)` or a bare `dbt.models` sends it to the **warehouse**. It then takes 10+ seconds and fails with errors like `Schema '<db>.DBT' does not exist`. A slow query or a warehouse error means the query went to the wrong engine. A misrouted query also writes `target/inline_<hash>.sql` and overwrites `target/run_results.json`; a correctly routed one leaves `target/` alone. | | Pass bare view names: `--info models`, `info_schema('models')`. | `dbt.models` is rejected as an unknown view. | | Use `--limit -1` when you need every row. | The default limit is 10, so counts and lists are silently truncated. | | Use `--quiet --output json` when you will parse the output. | Without `--quiet`, a version banner and an execution summary wrap the JSON. The table output also truncates wide columns. Errors still print under `--quiet`, and the exit code is 1. | | Filter `enabled` on **both sides** when counting resources. | `models` and `data_tests` include **disabled** rows. `dag_nodes` holds only enabled resources. The counts will not match. | | Filter on `package_name` to separate your project from installed packages. | Package models appear in the same views. Read your project's name with `select project_name from {{ info_schema('project') }}`. | | No `ref()`, `source()` or other project macros. | They fail with `unknown function: Jinja macro or function ref is unknown`. You can't join metadata with warehouse data in one query. Run two queries, or export to JSON or CS
A curated collection of Agent Skills for working with dbt. These skills help AI agents understand and execute dbt workflows more effectively.
Use when checking skills for security or quality issues, reviewing audit results from…
Generates a Mermaid flowchart diagram of dbt model lineage using MCP tools, manifest.json, or…
Use when a user needs help triaging dbt-core to dbt v2 migration errors. Runs dbt-autofix…
Use when migrating a dbt project from one data platform or data warehouse to another (e.g.,…
Use when a user wants to upgrade, update, or migrate a dbt project to the latest version —…
Creates unit test YAML definitions that mock upstream model inputs and validate expected…