> For the complete documentation index, see [llms.txt](https://docs.seemoredata.io/external-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seemoredata.io/external-docs/fundamentals/getting-set-up/setting-integrations/dbt/dbt-core.md).

# dbt Core

DBT Core integration to Seemore>data

{% hint style="info" %}
**Required role to configure:** [Admin](https://docs.seemoredata.io/external-docs/fundamentals/settings/user-roles.md) or higher.

Users with lower roles can view this feature but cannot change its configuration.
{% endhint %}

Seemore supports dbt core by using custom tags for classifying data assets that run through DBT core.

1. In order to integrate you would need to add the following tags package - [dbt query tags package](https://github.com/get-select/dbt-query-tags?tab=readme-ov-file#quickstart).
2. In order to add more informative metadata such as data orchestration tools that execute the DBT Queries[ add the following code](#airflow-example).

#### Quickstart

1. Add this package to your `packages.yml` file, then install it with `dbt deps`.

```yaml
packages:
  - package: get-select/dbt_query_tags
    version: [">=3.0.0", "<4.0.0"]
```

2. Add the query tags by configuring the dispatch search order in `dbt_project.yml`. This requires dbt 1.2 or later.

```yaml
dispatch:
  - macro_namespace: dbt
    search_order:
      - <YOUR_PROJECT_NAME>
      - dbt_query_tags
      - dbt
```

3. To configure the query comments, add the following config to `dbt_project.yml`.

```yaml
query-comment:
  comment: '{{ dbt_query_tags.get_query_comment(node) }}'
  append: true # Snowflake removes prefixed comments.
```

That's it! All dbt-issued queries will now be tagged.

{% hint style="info" %}
**Already using `dbt_snowflake_query_tags`?** That package has been renamed to `dbt_query_tags` and is no longer maintained. Your existing setup keeps working. To move to the new package, replace `dbt_snowflake_query_tags` with `dbt_query_tags` in `packages.yml` (with version `[">=3.0.0", "<4.0.0"]`), in the `dispatch` search order and in the `query-comment` config, then run `dbt deps`.
{% endhint %}

\
Once the dbt package to automatically tag dbt-issued queries with informative metadata has been added you can add more informative information such as **Orchestration tools** used to execute DBT queries.

#### Airflow Example

```yaml
query-comment:
  comment: >
    {{ dbt_query_tags.get_query_comment(
      node,
      extra={
        'workflow_id': env_var('AIRFLOW_CTX_DAG_ID', 'default_dag_id'),
        'job_id': env_var('AIRFLOW_CTX_TASK_ID', 'default_task_id'),
        'scheduler': 'airflow'
      }
    ) }}
  append: true # Snowflake removes prefixed comments.
```

**Github Actions**

```yaml
query-comment:
  comment: >
    {{ dbt_query_tags.get_query_comment(
      node,
      extra={
        'workflow_id': env_var('GITHUB_WORKFLOW', 'default_dag_id'),
        'job_id': env_var('GITHUB_JOB', 'default_task_id'),
        'scheduler': 'github_actions'
      }
    ) }}
  append: true # Snowflake removes prefixed comments.
```

**Gitlab**

```yaml
query-comment:
  comment: >
    {{ dbt_query_tags.get_query_comment(
      node,
      extra={
        'workflow_id': env_var('CI_PIPELINE_ID', 'default_dag_id'),
        'job_id': env_var('CI_JOB_NAME', 'default_task_id'),
        'scheduler': 'gitlab'
      }
    ) }}
  append: true # Snowflake removes prefixed comments.
```
