elementary-data / elementary

The dbt-native data observability solution for data & analytics engineers. Monitor your data pipelines in minutes. Available as self-hosted or cloud service with premium features.
https://www.elementary-data.com/
Apache License 2.0
1.86k stars 158 forks source link

DBT Invocations: support task_id and try_number #1472

Open kokorin opened 5 months ago

kokorin commented 5 months ago

Is your feature request related to a problem? Please describe.

We run DBT with Elementary package in Airflow. Airflow DAG contains several DBT build tasks: core models first, then integration models (based on core). We want to build separate Elementary reports for core module and for each integration module:

flowchart LR
  freshness --> build_core --> elementary_core
  build_core --> build_integration_1 --> elementary_integration_1
  build_core --> build_integration_2 --> elementary_integration_2

For that we need to get dbt_invocation UUID from DBT Invocations table and use it with edr report --select invocation_id:XXXXXXXXXXXXX.

It would be useful to have Airflow task_id and try_number in DBT Invocations table to simplify dbt_invocation lookup

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered It's possible to include task_id and try_number into job_id or job_run_id, but Elementary uses the latter vars to build job_url and job_run_url.

Additional context N/A

Would you be willing to contribute this feature? Yes, but I don't have DBT Cloud and have limited experience with Github Actions.

haritamar commented 3 months ago

Hi @kokorin ! Thanks for opening this issue, and sorry about the delayed response.

This is a cool use case! Makes sense to me overall to save this information. I'd use separate fields rather than incorporate it into existing ones. I think also that since this information is passed as external variables to dbt, then the feature is generic and doesn't necessarily require explicit logic for dbt Cloud / github actions, so I think you should be fine there.

Feel free to open a PR that adds this capability, lmk if further guidance is needed!