Databao docs

Generate semantic layer

Before you begin
  1. Install Databao CLI

  2. Make sure you have the following set up:

    • Claude Code installed and configured
    • A Google account
    • A directory containing your dbt project

Run Databao CLI

  1. In the terminal, navigate to the root of your dbt project.

  2. Launch Databao

    Terminal
    databao

Sign in

If you haven't logged in yet, Databao will open a browser tab for you to sign in with your Google account.

Generate semantic layer

  1. In the terminal, select Start Databao in Claude Code:

    Terminal
    ? What would you like to do? (Use arrow keys)
    » Start Databao in Claude Code
    Advanced settings
    Quit

    When prompted, confirm that you trust the project.

  2. Wait while Databao is assessing the project.

    Depending on your Claude settings, you may need to confirm if you allow Claude and Databao to run certain commands.

    If your project is not a Git repository, Databao will will initialize it so that you can version control the generated semantic layer.

  3. Review the questions proposed by Databao:

    Terminal
     Here are 3 questions I can build a semantic layer for:
    
    #  Question                                                Metric                    Formula
    ──────────────────────────────────────────────────────────────────────────────────────────────
    1  What is the total revenue from paid orders over time?  total_order_revenue       SUM(total_price)
    2  How many abandoned checkouts occur each month, and     abandoned_checkout_count  COUNT(id)
      what is the total value left behind?
    3  How many new customers are acquired each month?        new_customers_acquired    COUNT(id)
    
    These questions will define your semantic layer. You can:
    - Type ok to proceed with all of them
    - Remove some, e.g. remove 1, 3
    - Add new ones, e.g. add: what's our average order value?
    - Type more to generate additional questions (optionally with a hint, e.g. more: focus on retention)
  4. If needed, describe what you would like to change. When done, type ok and then confirm that you want to proceed:

    Terminal
    Ready to generate the semantic layer for these questions. Shall I proceed?
    ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     Confirm
    
    Proceed with these five question?
    
     1. ok
         Generate the semantic layer
      2. Change it
         Describe what you'd like instead
      3. Type something.
    ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    4. Chat about this

    Generating the semantic layer may take some time depending on the complexity of your project.

Review the semantic layer

  1. Once Databao is ready, you can review the summary:

    Terminal
     Step 3 Cycle summary
    
    Cycle summary
    ─────────────
    Intent:         "bootstrap semantic layer for total revenue from paid orders"
    Files added:    2
      models/semantic/_time_spine.yml
      models/semantic/sem_shopify__orders.yml
    Files modified: 2
      profiles.yml
      .databao/test_questions.csv
    Test set:       3 questions covered (was 0)
    Validation:     dbt parse OK, mf validate-configs OK
    
    Questions added/touched:
    
    1. What is the total revenue from paid orders over time?
       Metric: total_revenue_paid_orders  |  Formula: SUM(total_price)
       Result:
       | metric_time__day    | total_revenue_paid_orders |
       |---------------------|---------------------------|
       | 2020-09-09          | 9.18                      |
    ...
  2. If you're happy with the result, you can commit it to save the current version:

    Terminal
     Next step
    
    What's next?
    
    ❯ 1. Commit
         Record this cycle in git and continue
      2. Refine
         Describe what to change; I'll iterate within this cycle
      3. Revert
         Undo this cycle, restore pre-cycle state
      4. Leave
         Continue without committing this cycle
      5. Type something.
    ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
      6. Chat about this

On this page