Skip to content

Quick Start Example

dct init creates a charts/guide.yml starter board in your project. It works without a database: its sample data is inline. You can open it in your browser immediately with dct serve.

This page walks through a minimal example to explain the key concepts.


Complete Board

title: "Hello World Board"

source: db

queries:
  sales:
    sql: |
      SELECT month, revenue
      FROM dundersign_serving.monthly_metrics

rows:
  - title: "Monthly Revenue"
    charts:
      revenue_chart:
        title: "Revenue by Month"
        query: queries.sales
        type: bar
        x: month
        y: revenue
    cols:
      - revenue_chart

Step-by-Step Explanation

1. Board Definition

title: "Hello World Board"
  • title: Display title (optional but recommended)

2. Query Definition

queries:
  sales:
    sql: |
      SELECT month, revenue
      FROM dundersign_serving.monthly_metrics
  • sales: Query name (use descriptive names)
  • sql: A plain SQL query, run against the source: declared on the board
  • dundersign_serving.monthly_metrics: A pre-aggregated rollup from the Dundersign demo dataset

3. Section and Chart

rows:
  - title: "Monthly Revenue"
    charts:
      revenue_chart:
        title: "Revenue by Month"
        query: queries.sales
        type: bar
        x: month
        y: revenue
    cols:
      - revenue_chart
  • rows: Top-level layout (vertical stack)
  • title: Section title
  • charts: Chart definitions
  • cols: Nested horizontal layout containing the chart reference
  • revenue_chart: Chart identifier
  • query: queries.sales: References the query defined above (use queries. prefix for clarity)
  • type: bar: Bar chart type
  • x: month: X-axis uses the month column
  • y: revenue: Y-axis uses the revenue column

How to Run It

  1. Save this YAML to a file (for example, hello_world.yml)
  2. Validate it:
    dct validate hello_world.yml
    
  3. Preview it:
    dct serve
    
  4. Open your browser to the URL printed by dct serve on startup

What You'll See

  • A bar chart showing revenue by month
  • Data fetched via a plain SQL query against your warehouse
  • A responsive layout that works on any device

Next Steps