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

Define Macro and Group resources in dbt/artifacts #9439

Merged
merged 5 commits into from
Jan 26, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Jan 24, 2024

resolves #9382
resolves #9381

Problem

  • Moving Macro and Group schema definitions to dbt/artifacts/resources

Solution

  • Split Macro into resource (defined in dbt/artifcats/resources/v1) and internal representation
  • Move dependency Docs to dbt/artifacts
  • Renaming import of DocumentationArtifact to DocumentationResource for consistent naming
  • Split Group into functional & resource classes
  • rename BaseArtifactNode to BaseResource

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

@cla-bot cla-bot bot added the cla:yes label Jan 24, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ad723a6) 87.85% compared to head (90f2155) 87.85%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9439      +/-   ##
==========================================
- Coverage   87.85%   87.85%   -0.01%     
==========================================
  Files         160      164       +4     
  Lines       21935    21965      +30     
==========================================
+ Hits        19272    19298      +26     
- Misses       2663     2667       +4     
Flag Coverage Δ
integration 85.32% <100.00%> (+<0.01%) ⬆️
unit 62.48% <100.00%> (+0.05%) ⬆️

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.

macros: List[str] = field(default_factory=list)

# 'in' on lists is O(n) so this is O(n^2) for # of macros
def add_macro(self, value: str):
Copy link
Contributor Author

@MichelleArk MichelleArk Jan 25, 2024

Choose a reason for hiding this comment

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

Went back and forth on whether this method belongs in dbt/artifacts given it is mutating / not read-only. An alternative would be to define the method more directly on the internal Macro node class.

Decided to leave it as-is for now because DependsOn inherits from MacroDependsOn. We should revisit a design once we move DependsOn though.

Copy link
Contributor

Choose a reason for hiding this comment

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

For those looking in @MichelleArk and I have talked about this a bit in DMs. In my PR #9460 I plan on moving DependsOn in full over to artifacts. We plan in the future to revist the design of both MacroDependsOn and DependsOn to perhaps simplify and improve them.

@MichelleArk MichelleArk marked this pull request as ready for review January 25, 2024 15:05
@MichelleArk MichelleArk requested a review from a team as a code owner January 25, 2024 15:05
@MichelleArk MichelleArk requested review from aranke and QMalcolm and removed request for aranke January 25, 2024 15:05
@MichelleArk MichelleArk changed the title first pass: move Macro to dbt/artifacts Define Macro resource in dbt/artifacts Jan 25, 2024
@MichelleArk MichelleArk changed the title Define Macro resource in dbt/artifacts Define Macro and Group resources in dbt/artifacts Jan 25, 2024
Copy link
Contributor

@QMalcolm QMalcolm left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@MichelleArk MichelleArk merged commit 77d48cc into main Jan 26, 2024
51 checks passed
@MichelleArk MichelleArk deleted the move-macro-contract branch January 26, 2024 20:28
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-3552] Define Macro contract in dbt/artifacts [CT-3551] Define Group contract in dbt/artifacts
2 participants