1

I'm trying to get the DBT_CLOUD_JOB_ID - as dbt_artifact seems to do (here):

{ set dbt_cloud_job_id = env_var('DBT_CLOUD_JOB_ID', '') %}
{{ log("LOG dbt_cloud_job_id: " ~ dbt_cloud_job_id) }}

Prints:

LOG dbt_cloud_job_id: 

But I'm not succeeding. It returns empty. is there a better way to get this dbt cloud job id or am I missing something here?

[EDIT]

The problem was a syntax error {% %}

{% set dbt_cloud_job_id = env_var('DBT_CLOUD_JOB_ID', '') %}
  • 1
    I believe that environment variable is expecting a dbt Cloud environment, so unless you run that log() within a dbt Cloud job, you will not get anything printed. To print it locally, you would need to set it up elsewhere (e.g. in an .env file) – Aleix CC Apr 13 '23 at 15:03

0 Answers0