Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an Artifact ID rather than a composite OR statment in several places. #81

Merged
merged 14 commits into from
Feb 2, 2022

Conversation

alanmcruickshank
Copy link
Contributor

In several places we had:

on models.command_invocation_id = latest_compile.command_invocation_id
    or models.dbt_cloud_run_id = latest_compile.dbt_cloud_run_id

This PR replaces that idiom with a single identifier created in the base artifacts model, made from a coalesce of the two original IDs, then hashed. I think it's much cleaner and more future proof.

Would appreciate feedback on whether SHA2 is overkill or whether MD5 might be more pragmatic @NiallRees.

@alanmcruickshank alanmcruickshank temporarily deployed to Approve Integration Tests February 2, 2022 13:57 Inactive
Comment on lines 39 to 40
-- This ID provides a reliable ID, regardless of whether running in a local or cloud environment.
sha2_hex(coalesce(dbt_cloud_run_id, command_invocation_id), 256) as artifact_run_id,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NiallRees - this is the bit that I'd love your view on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea. Linked issue: #53

@alanmcruickshank alanmcruickshank temporarily deployed to Approve Integration Tests February 2, 2022 14:29 Inactive
@alanmcruickshank alanmcruickshank temporarily deployed to Approve Integration Tests February 2, 2022 21:08 Inactive
@alanmcruickshank alanmcruickshank temporarily deployed to Approve Integration Tests February 2, 2022 21:08 Inactive
select
command_invocation_id,
dbt_cloud_run_id
select artifact_run_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we're joining on this new key, can we keep the command_invocation_id and dbt_cloud_run_id in these models? Both are potentially useful to users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nvm they weren't in the model output anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants