Queries and data¶
How do I query a dbt model?¶
Write SQL against a dbt_profile source and use {{ ref('model_name') }}. Run dbt parse first so target/manifest.json exists. See Queries.
Can my boards live in a different repo from my dbt project?¶
Yes. Set dbt_project_dir: ../my_dbt_project in dbt_charts.yml (or export DBT_PROJECT_DIR), and dbt Charts reads the manifest and profile from there. See Boards in a separate repo.
How do I connect to my warehouse?¶
In a dbt project there is nothing to add: with no sources: declared, dbt Charts uses your dbt profile. Otherwise (or to pick a profile target) add a sources: entry to dbt_charts.yml: type: dbt_profile to reuse your dbt profile, or a direct postgres, snowflake, bigquery, duckdb, or sqlite block. See Sources.
Which warehouses are supported?¶
BigQuery, Snowflake, Postgres, Redshift, DuckDB, SQLite, SQL Server, Trino, Athena, ClickHouse, Databricks, and Spark, plus CSV, Parquet, and JSON files. See Source Types.
How do I use a CSV file as a data source?¶
Add a type: csv source pointing at the file (or folder) in dbt_charts.yml, then query it with SQL. See Files. On dbtcharts.com, New > Data file⦠on the project home does both steps for you: see Upload a file on dbtcharts.com.
How do I put a few rows of data straight into the YAML?¶
Use a values query: rows: with a list of mappings, or columns: plus values:. No database needed. See Values Queries.
How do I chart data from an API?¶
Load the API's data into your warehouse (for example with a Fivetran connector) and query it with SQL, or save it as a CSV, JSON, or Parquet file in your repository and register a file source. Boards cannot call an API at render time.
Can I use one query for several charts?¶
Yes. Name the query once under queries: and reference it from each chart with query: <name>. It runs once. See Reuse Queries Across Charts.
Can one query build on another?¶
Yes. Reference it as {{ queries.other_query }} inside your SQL and it is inlined as a subquery. See Query References.
How do I limit the number of rows?¶
Set limit: on the query. Chart-level row limiting does not exist. See Raw SQL Queries.
How do I group by week, month, or quarter?¶
Bucket the date in SQL (DATE_TRUNC) and chart the bucketed column; the axis picks up the grain. See Use Time Grain.
Can I join data from two different sources?¶
Yes. Reference each query's cached rows with {{ queries.name.cache }} and the join runs in the local cache engine (DuckDB). Plain {{ queries.name }} references must share a source. See Join across sources.
Many charts read one expensive query. Does it run once per chart?¶
With {{ queries.base }}, yes: the base is inlined, so it runs inside every chart's query. Read it with {{ queries.base.cache }} instead and it runs once, with each chart's query running over its cached rows in the local cache engine (DuckDB). Write those queries in DuckDB SQL, or set dialect: to write them in your warehouse's SQL. See Run a shared base once.
How do I refresh the data?¶
Locally, restart dct serve, pass --no-cache, or set a cache.ttl in dbt_charts.yml. See Caching; Cloud's refresh is described in Refresh.
Can I schedule a refresh?¶
Locally, a cron job running dct render with a persistent --cache file does the job. For Cloud, see Refresh.
Why is my dashboard slow?¶
Usually one heavy query. Add limit:, aggregate in SQL rather than fetching raw rows, and reuse queries across charts. See Performance Optimization.
How do I check my SQL without rendering anything?¶
dct query board.yml <query-name> runs one query and prints rows; --validate lints it. See dct query.