brooklyn-data / dbt_artifacts

A dbt package for modelling dbt metadata. https://brooklyn-data.github.io/dbt_artifacts
Apache License 2.0
330 stars 125 forks source link

`fct_dbt__critical_path` table is empty for those using run-operations to upload artifacts #15

Closed bbesash closed 2 years ago

bbesash commented 3 years ago

Hey there - was working on installing this package and was running into some issues with the fct_dbt__critical_path table being empty. I took out part of the CTE in fct_dbt_latestfull_model_executions that filters for full runs as this is not super helpful to us i.e.

latest_full as (
    select *
    from run_results
    where 
    --selected_models is null and
     was_full_refresh = false
    order by artifact_generated_at desc
    limit 1
),

but still no dice. I thought it was because the model joins on command_invocation_id which seems to be different for each artifact created> As in the run_result json has a different id than the manifest.json even though we are running them on the same command line? that join happens in the same model here-

joined as (
    select
        model_executions.*
    from latest_full
    left join model_executions on model_executions.command_invocation_id = latest_full.command_invocation_id

Any help is greatly appreciated.

clrcrl commented 3 years ago

Suggested edits:

fct_dbt__critical_path table is empty for those using run-operations to upload artifacts

Because run-operation rewrites manifest.json (with a new command_invocation_id), the join on command_invocation_id doesn't work.

I haven't dug in further here, but the solution will probably involve joining on some other columns, like a job_id (extracted from an environment variable)

kgpayne commented 3 years ago

Created issue #19 to fix and document the root-cause of this issue 🙂

NiallRees commented 2 years ago

I've confirmed that this is working - @alanmcruickshank feel free to close

NiallRees commented 2 years ago

I'm unable to reproduce this issue so will close for now.