Skip to content

Using dbt models

If you manage your warehouse models with dbt, you can keep your dbt project as the source of truth for Supersimple data models too.

The Supersimple CLI converts dbt's generated manifest.json and catalog.json artifacts into a Supersimple YAML file. Supersimple-specific metadata lives alongside each model and column under config.meta.supersimple, so the generated file does not need to be edited manually.

From your dbt project, generate the dbt artifacts and convert them with:

bash
dbt docs generate
supersimple dbt convert

1. Add Supersimple annotations to dbt

Enable each dbt model that you want to expose in Supersimple under config.meta.supersimple:

yaml
version: 2

models:
  - name: customers
    description: Customer accounts, excluding test accounts and administrators.
    config:
      meta:
        supersimple:
          enabled: true
          model_id: customers
          primary_key: [customer_id]
          relations:
            transactions:
              name: Transactions
              type: hasMany
              model_id: transactions
              join_strategy:
                join_key: customer_id

    columns:
      - name: customer_id
        description: Unique customer ID.
        data_tests: [not_null, unique]

      - name: status
        description: Current customer status.
        config:
          meta:
            supersimple:
              type: Enum
              enum_options:
                load: distinct_values

Models without enabled: true are ignored.

Model annotations

FieldPurpose
enabledInclude this dbt model in the generated Supersimple configuration. Must be true.
model_idStable Supersimple model ID. Defaults to the dbt model name.
nameUser-facing model name. Defaults to the dbt model name.
descriptionOverrides the native dbt model description.
primary_keyOne or more property keys that uniquely identify a row. Strongly recommended, but not required.
relationsRelations to other Supersimple models.
operationsOperations that should always be applied to the model.
labelsModel labels, including sidebar organization.
semanticsSemantic model kind and its property mappings.
accessModel access-control configuration.
connectionDatabase connection to use when the account has more than one.

Except for enabled and model_id, these fields use the same shapes as the corresponding fields in Supersimple data model YAML.

Column annotations

Add column-level annotations under columns[].config.meta.supersimple:

FieldPurpose
nameUser-facing property name. Defaults to the physical column name.
descriptionOverrides the native dbt column description.
typeOverrides the type inferred from catalog.json.
formatDisplay format, such as usd or percentage.
column_typePhysical temporal type for a Date property: date, datetime, timestamp, or time.
precisionSemantic granularity for a Date property, such as month or day.
enum_optionsStatic or dynamically loaded options for an Enum property.
sqlCustom SQL expression for the property.

Native dbt model and column descriptions are carried over automatically. Physical column types come from catalog.json, while explicit type annotations take precedence.

dbt tests are not interpreted as Supersimple metadata. For example, unique and not_null tests do not automatically define a primary key, and accepted_values does not automatically create an enum. Annotate primary_key and enum properties explicitly when needed.

2. Generate the dbt artifacts

Run this from the dbt project directory after materializing the enabled models:

bash
dbt docs generate

Use the same dbt profile and target that contain the models you want to expose in Supersimple.

3. Convert to Supersimple YAML

Run the converter from the dbt project directory:

bash
supersimple dbt convert

With dbt's default target/ directory, no flags are needed. The command writes supersimple-models.yml in the current directory.

If your artifacts are stored elsewhere, specify their directory:

bash
supersimple dbt convert --artifacts-dir build/dbt

To use a different output path:

bash
supersimple dbt convert -o generated/supersimple-models.yml

The output is marked as generated and can be safely refreshed by rerunning the command. The converter refuses to replace an existing hand-written file unless you explicitly pass --force.

TIP

Treat the generated Supersimple file as a build artifact: do not edit it manually. Put Supersimple-specific changes in the dbt annotations, then regenerate the file. You can add supersimple-models.yml to .gitignore when it is generated during CI.

Run supersimple dbt convert --help for the complete list of supported annotations, adapters, and command options.

4. Validate and import

Validate the generated models before importing them:

bash
supersimple validate supersimple-models.yml --validate-sql

Then import them into Supersimple:

bash
supersimple import supersimple-models.yml --validate-sql

If your account also has hand-written metrics or other configuration files, pass all related files to the same validation and import command:

bash
supersimple validate supersimple-models.yml metrics/
supersimple import supersimple-models.yml metrics/

See Using the CLI for installation and authentication instructions.

Current limitations

  • PostgreSQL, ClickHouse, and BigQuery dbt adapters are currently supported.
  • Ephemeral models are not supported. Materialize a model before converting it.

Keeping models in sync

Run the artifact generation, conversion, and import steps after deploying dbt models:

bash
dbt docs generate
supersimple dbt convert
supersimple import supersimple-models.yml --validate-sql

This can run locally or in CI. The environment needs dbt warehouse credentials for dbt docs generate and Supersimple CLI credentials for the import. See Syncing data models from Git for the Supersimple authentication variables used in GitHub Actions.

Avoid --delete-dangling unless the files passed to supersimple import represent the complete model configuration for the account.