Appearance
CLI: Publishing a dashboard - From start to finish
This guide takes you from an empty folder to a published dashboard with a chart that viewers can filter by time. It takes about ten minutes.
You need:
- The
diverCLI. See Installation. - A Diver workspace with at least one data source, and the Analyst or Admin role in it.
1. Log in
bash
diver loginPaste the code in the browser, choose your workspace and select Authorize. See Authorization for details.
2. Find your data source's name
Charts refer to data sources by their resource name. List them:
bash
diver sourcestext
warehouse-prod Warehouse (production)The first column is the resource name; the second is the name shown in Diver. This guide uses warehouse-prod.
3. Write the dashboard file
Create sales.diver.yml in your project, for example next to your dbt models:
yaml
version: 1
resource_name: sales
name: Sales
dashboards:
- resource_name: sales-overview
name: Sales overview
dimensions: { width: 12, height: 8 }
charts:
- resource_name: orders-over-time
title: Orders over time
visualization: line
position: { x: 1, y: 1 }
size: { width: 8, height: 4 }
dataset:
source: warehouse-prod
query: |
SELECT {created_at:aggregation} AS period, count(*) AS orders
FROM orders
WHERE {created_at=timerange}
GROUP BY period
ORDER BY period
- resource_name: revenue
title: Revenue
visualization: number
position: { x: 9, y: 1 }
size: { width: 4, height: 4 }
dataset:
source: warehouse-prod
query: |
SELECT sum(amount) AS revenue
FROM orders
WHERE {created_at=timerange}Change the table and column names to match your data. The {…} placeholders give the dashboard a time range picker and a picker for grouping by day, week or month.
4. Preview it
bash
diver preview sales.diver.ymlDiver opens the preview group Preview: Sales in your browser. Only you can see it, under Personal previews in the dashboard list. Try the time range picker and check both charts.
To change something, edit the file and run diver preview again. The preview updates in place.
5. Get a review (optional)
To have a teammate check the dashboard before everyone sees it, share the preview group from Diver. See Share a preview.
6. Publish it
bash
diver publish sales.diver.ymlSales overview is now a workspace dashboard. Add it to a dashboard group to share it with others.
From now on, change the dashboard by editing the file, previewing, and publishing again. Diver matches the dashboard and its charts by their resource_name values and updates them in place. Remember that charts you remove from the file are removed from the dashboard too.
Next steps
- Learn every field in the dashboard language.
- Add a custom filter so viewers can filter by region or product.
- See how query results become charts for the other chart types.