Skip to main content

The dbt Extension

dbt is a powerful tool to transform your data, and VulcanSQL supports queries from dbt models directly. If you use dbt to create some models, you can make APIs for them instantly.

Installation

We need to install an additional package to integrate with dbt:

  1. Install package(If you have VulcanSQL in the binary version, you can skip this step)

    npm i @vulcan-sql/extension-dbt
  2. Setup vulcan.yaml

    extensions:
    dbt: '@vulcan-sql/extension-dbt' # add this line
    dbt:
    modelFiles:
    - ./target/manifest.json # config the path to manifest.json
    info

    Manifest is an artifact which is built from dbt cli, it should be located at “./target/manifest.json”

    info

    We are not able to share profiles with dbt yet, you need to config profiles for both VulcanSQL and dbt separately.

  3. Setup profiles.yaml(if you are using DuckDB as the data source for your dbt project)

    Add persistent-path to the profiles.yaml in the root of your VulcanSQL project like following

    - name: duckdb
    type: duckdb
    connection:
    persistent-path: [duckdb db file path of your dbt project]
    allow: "*"

Setup of your dbt project

Please refer to the dbt Quickstarts turotials

Using the dbt extension

Using models of dbt is extremely easy, you only need to use the following syntax in your VulcanSQL project.

{% dbt "model.<project-name>.<model-name>" %}

For example, to query all data from model my_first_dbt_model in the project demo:

select * from {% dbt "model.demo.my_first_dbt_model" %}

Examples

You can check out this dbt-jaffle-shop example for further details!