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

add allow additional property for Model and SourceDefinition #11138

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

ChenyuLInx
Copy link
Contributor

Allowing additional properties on Model and SourceDefinition so we are more forgiving at reading artifacts.
This change doesn't change user contract. User still cannot add additional fields to project freely

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 or 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.

@ChenyuLInx ChenyuLInx requested a review from a team as a code owner December 12, 2024 00:04
@cla-bot cla-bot bot added the cla:yes label Dec 12, 2024
@ChenyuLInx ChenyuLInx added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Dec 12, 2024
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.85%. Comparing base (7df04b0) to head (e904714).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11138      +/-   ##
==========================================
- Coverage   88.89%   88.85%   -0.05%     
==========================================
  Files         187      187              
  Lines       23974    23978       +4     
==========================================
- Hits        21312    21305       -7     
- Misses       2662     2673      +11     
Flag Coverage Δ
integration 86.16% <75.00%> (-0.05%) ⬇️
unit 61.97% <75.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
Unit Tests 61.97% <75.00%> (+<0.01%) ⬆️
Integration Tests 86.16% <75.00%> (-0.05%) ⬇️

@ChenyuLInx ChenyuLInx requested a review from a team as a code owner December 12, 2024 19:07
@ChenyuLInx ChenyuLInx requested review from PaulVPham and removed request for a team December 12, 2024 19:07
@@ -9121,19 +9133,7 @@
"type": "integer"
},
"granularity": {
"enum": [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why this gets changed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked out main branch and generated a schema, these changes are also there, so it is not particular to this PR

@@ -372,6 +372,7 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False):
"version": None,
"latest_version": None,
"time_spine": None,
"batch": None,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure why I would have to add this field in expected manifest

@@ -503,6 +503,8 @@ def verify_manifest(project, expected_manifest, start_time, manifest_schema_path
elif key in ["nodes", "sources", "exposures", "metrics", "disabled", "docs"]:
for unique_id, node in expected_manifest[key].items():
assert unique_id in manifest[key]
if "_event_status" in manifest[key][unique_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.

Not sure why _event_status starts to pop up

@ChenyuLInx ChenyuLInx force-pushed the cl/allow_additional_property_for_model_and_source branch 3 times, most recently from 0f762b9 to 13acd66 Compare December 12, 2024 21:51
@ChenyuLInx ChenyuLInx force-pushed the cl/allow_additional_property_for_model_and_source branch from 26f80b7 to 7acd049 Compare December 12, 2024 22:36
@@ -51,4 +52,10 @@ def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None):
dct = super().__post_serialize__(dct, context)
if context and context.get("artifact") and "defer_relation" in dct:
del dct["defer_relation"]

# delete extra keys that should't be serialized
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gshank @QMalcolm I figured out the reason batch suddenly started to show up is because we allow extra on Model, so when we convert ModelNode to Model when writing an artifact, it will be kept as extra and convert into keys in dct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhhhhhhhh that makes sense. Thank you for figuring this out and removing it with the below process 👍

@ChenyuLInx ChenyuLInx force-pushed the cl/allow_additional_property_for_model_and_source branch from f800044 to fda1eb9 Compare December 13, 2024 23:09
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.

@ChenyuLInx ChenyuLInx added Skip Changelog Skips GHA to check for changelog file artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking and removed artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking labels Dec 13, 2024
# that are not present in the schema, from_dict will work fine.
# As long as validate is not called, the schema will not be enforced.
# This is intentional, as it allows for safer schema upgrades.
raise RuntimeError(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be a dbtInternalError

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.

Small comment, otherwise LGTM! Thank you for adjusting the v12.json for future CI runs 👍

@ChenyuLInx ChenyuLInx merged commit 4b1f1c4 into main Dec 16, 2024
54 of 56 checks passed
@ChenyuLInx ChenyuLInx deleted the cl/allow_additional_property_for_model_and_source branch December 16, 2024 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants