Hi All,
I have a requirement to save the dbt model run_results in a table.
My intention is to capture the below values in a table
“rows_affected”: 0
“execution_time”: 0.6479620933532715
“status”: “success”
“name”: “execute”,
“started_at”: “2024-04-05T14:14:25.859480Z”,
“completed_at”: “2024-04-05T14:14:26.487512Z”}
I tried using the macro below, but no results were captured and entered into the table after a model run.
{% macro store_run_results(run_results) %}
{% for model in run_results %}
{% set res = model %}
INSERT INTO dbt_meta.model_run_results1 (res)
VALUES ('{{ res }}');
{% endfor %}
{% endmacro %}
dbt_project.yml
on-run-end:
- “{{ store_run_results(run_results) }}”
Can someone help me with the logic or idea?