Recipe: CSV files to a live dashboard¶
End-to-end walkthrough — drop a CSV, ingest it, transform it, and put it on a dashboard. Fully offline.
Setup¶
The csv-import template ships:
- A
data/input/widgets.csvsample - A working
dbt_project/with one staging model - An empty
rill/ready for dashboards
1. Drop your real CSVs¶
Replace the sample CSV with your own files:
cp ~/Downloads/orders.csv data/input/orders.csv
cp ~/Downloads/customers.csv data/input/customers.csv
By default, tycoon.yml has the files source configured to glob data/input/*.csv. Open tycoon.yml to confirm:
sources:
files:
type: filesystem
schema: raw_files
config:
bucket_url: data/input
file_glob: "*.csv"
2. Ingest¶
Each .csv lands as a table under the raw_files schema in data/raw.duckdb. Quick sanity check:
tycoon data query --source files "SELECT count(*) FROM raw_files.orders"
tycoon data schema --db data/raw.duckdb
3. Generate staging models¶
This writes one staging model per CSV under dbt_project/models/staging/:
Each .sql is a typed SELECT * from the raw table — edit them to add filtering, renaming, casting. The default is "passthrough with _dlt_* columns excluded."
4. Build mart models (your business logic)¶
This is the part tycoon doesn't generate — it's your project. Add a mart model:
mkdir -p dbt_project/models/mart
cat > dbt_project/models/mart/fct_orders.sql <<'EOF'
SELECT
o.order_id,
o.customer_id,
c.customer_name,
o.order_total,
o.order_date
FROM {{ ref('stg_files__orders') }} o
JOIN {{ ref('stg_files__customers') }} c USING (customer_id)
EOF
Run dbt:
fct_orders lands in data/warehouse.duckdb's mart schema. Inspect:
5. Generate dashboards¶
Writes Rill source / metrics_view / dashboard YAMLs for every staging table. For mart-level dashboards (the more useful ones), hand-edit rill/dashboards/fct_orders.yaml:
6. Open the dashboard¶
Browse to http://localhost:9009. You'll see:
- Your auto-generated
stg_files__*dashboards - Your hand-customized
fct_ordersdashboard (if you wrote it) - Two
_tycoon_*dashboards showing pipeline health
7. Refresh¶
When the underlying CSVs change:
# Full rebuild
tycoon data run-all
# Or piecemeal
tycoon data sources run files
tycoon data transform run
Both update the warehouse, refresh the Parquet exports, and the open Rill dashboard reloads automatically.