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

Move SavedQuery data artifact to dbt/artifacts #9460

Merged
merged 11 commits into from
Jan 29, 2024

Conversation

QMalcolm
Copy link
Contributor

@QMalcolm QMalcolm commented Jan 26, 2024

resolves #9386

Problem

We are moving data artifacts to dbt/artifacts in a piecewise fashion. We needed to move SavedQuery as part of that.

Solution

Moved data portion of SavedQuery to dbt/artifacts (and all other classes that doing so required)

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@QMalcolm QMalcolm added the Skip Changelog Skips GHA to check for changelog file label Jan 26, 2024
@cla-bot cla-bot bot added the cla:yes label Jan 26, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (1cbc6d3) 87.89% compared to head (94c0806) 87.96%.
Report is 1 commits behind head on main.

Files Patch % Lines
core/dbt/artifacts/resources/v1/components.py 88.46% 3 Missing ⚠️
core/dbt/contracts/graph/nodes.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9460      +/-   ##
==========================================
+ Coverage   87.89%   87.96%   +0.07%     
==========================================
  Files         164      165       +1     
  Lines       21967    21975       +8     
==========================================
+ Hits        19307    19331      +24     
+ Misses       2660     2644      -16     
Flag Coverage Δ
integration 85.50% <96.82%> (+0.14%) ⬆️
unit 62.53% <94.44%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This is important because we want to move the `Export` class to artifacts.
However, because it had functional parts we would have split it in half,
with the data definition exists in artifacts and the functional specification
defined in core. At first glance thats not problematic. However, the
`SavedQuery` definition in artifacts would only be able to point at the
data definition of `Export`, and then the function `SavedQuery` spec in
core would have to override that with the functional `Export` definition
that exists in core. This would make the inheritance rather wonky and
confusing. This refactor simplifies thigs greatly because now we can move
the entirety of `Export` to artifacts, and the core `SavedQuery` won't
have to override anything.
Specifically the components in `contracts/graph/saved_queries.py` which
are `Export`, `ExportConfig`, and `QueryParams` got moved to
`artifacts/resources/v1/saved_query.py`. The moving of `Export` was
made possible by the refactor in the previous commit.
If we had followed the general paradigm we've set, we would have split
`DependsOn` into a data half and a functional half, with the data half
going in artifacts. However, doing so overly complicates the work that
we're doing. Additionally looking forward, we hope to simplify the
`DependsOn` (as well as `MacroDependsOn`) to use `sets` instead of
`lists`, thus allowing us to get rid of the fuctional part. We haven't
done that refactor here because there is a reasonable amount of risk
associated with such a change such that doign so should be it's own
segement of work.
I debated about making this two commits. However I only realized we
needed to also move `NodeVersion` when I was most the way through
moving `RefArgs`, and instead of stashing, I just decided to due both.
They're kind of inseparable anyways because it only makes sense to
move `NodeVersion` if you move `RefArgs`, but you can't move `RefArgs`
unless you also move `NodeVersion`. The two in one commit are still
small enough that I'm okay with this.
@QMalcolm QMalcolm force-pushed the qmalcolm--9386-move-saved-query-to-dbt-artifacts branch from 8ff0769 to 44a1f11 Compare January 27, 2024 00:41
@QMalcolm QMalcolm marked this pull request as ready for review January 27, 2024 00:41
@QMalcolm QMalcolm requested a review from a team as a code owner January 27, 2024 00:42
@QMalcolm QMalcolm removed the Skip Changelog Skips GHA to check for changelog file label Jan 27, 2024
@QMalcolm QMalcolm changed the title Move saved query to dbt artifacts Move SavedQuery data artifact to dbt/artifacts Jan 27, 2024
Copy link
Contributor

@MichelleArk MichelleArk left a comment

Choose a reason for hiding this comment

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

approved pending 🟢 CI, which should be fixed once this is rebased on main (& #9473 is merged)

@QMalcolm QMalcolm merged commit 3e2ec16 into main Jan 29, 2024
51 checks passed
@QMalcolm QMalcolm deleted the qmalcolm--9386-move-saved-query-to-dbt-artifacts branch January 29, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3556] Define SavedQuery contract in dbt/artifacts
3 participants