<@U088WCP3B4P> in BigQuery with elementary OSS, is...
# ask-elementary-ai
i
@kapa.ai in BigQuery with elementary OSS, is there a way to pass a custom tag at the dbt profile level using an env_var so that it is logged into the dbt_invocation table?
k
A message from kapa.ai
Based on the knowledge sources, you cannot directly pass a custom tag at the dbt profile level using an env_var and have it automatically logged into the
dbt_invocations
table in Elementary OSS. However, you can log custom metadata (such as a tag) into the
dbt_invocations
table by passing it as a dbt variable (
--vars
) or as an environment variable prefixed with
DBT_
when running your dbt commands. For example, to log a custom tag, you could do:
Copy code
bash DBT_CUSTOM_TAG="my_tag" dbt run
This will make the value available as an environment variable, and if you reference it in your dbt project (e.g., in
dbt_project.yml
or as a var), it can be captured. Elementary is designed to capture environment variables that are prefixed with
DBT_
and store them in the
dbt_invocations
table, as discussed in several Slack threads and documentation. You can also pass custom variables using the
--vars
flag:
Copy code
bash dbt run --vars '{"custom_tag": "my_tag"}'
These variables will be logged in the
vars
column of the
dbt_invocations
table, allowing you to track custom metadata per invocation. This approach is supported and recommended for capturing custom metadata such as tags, user, environment, etc. There is no indication in the knowledge sources that setting an env_var at the dbt profile level alone (without passing it at runtime) will result in it being logged by Elementary OSS. For more details, see the discussion on capturing custom metadata and environment variables in the
dbt_invocations
table: [Slack thread on custom metadata](https://slack.com/archives/C02CTC89LAX/p1666615460329049), [Elementary docs on collecting job data](https://docs.elementary-data.com/oss/guides/collect-job-data).