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 meta to SemanticModels #8754

Merged
merged 3 commits into from
Oct 3, 2023
Merged

Add meta to SemanticModels #8754

merged 3 commits into from
Oct 3, 2023

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Sep 29, 2023

resolves #8511
docs

Problem

No meta attribute on SemanticModels

Solution

Add meta under configs

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 Sep 29, 2023
@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (46ee3f3) 86.50% compared to head (16520c4) 86.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8754      +/-   ##
==========================================
+ Coverage   86.50%   86.53%   +0.02%     
==========================================
  Files         176      176              
  Lines       25820    25825       +5     
==========================================
+ Hits        22336    22348      +12     
+ Misses       3484     3477       -7     
Flag Coverage Δ
integration 83.30% <100.00%> (+0.03%) ⬆️
unit 65.11% <60.00%> (-0.01%) ⬇️

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

Files Coverage Δ
core/dbt/contracts/graph/model_config.py 92.20% <100.00%> (+0.02%) ⬆️
core/dbt/contracts/graph/nodes.py 95.09% <100.00%> (+<0.01%) ⬆️
core/dbt/contracts/graph/unparsed.py 93.52% <100.00%> (+0.01%) ⬆️
core/dbt/parser/schema_yaml_readers.py 91.98% <100.00%> (+0.06%) ⬆️

... and 2 files with indirect coverage changes

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

@emmyoop emmyoop marked this pull request as ready for review October 2, 2023 16:42
@emmyoop emmyoop requested review from a team as code owners October 2, 2023 16:42
@emmyoop emmyoop requested review from chrismorrisette-dbt and QMalcolm and removed request for a team October 2, 2023 16:42
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.

This looks great! I do have one question though on why we're supporting the legacy version of meta on a new node 🤔

Comment on lines +602 to +605
# If we have meta in the config, copy to node level, for backwards
# compatibility with earlier node-only config.
if "meta" in config and config["meta"]:
parsed.meta = config["meta"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have to support the legacy way for a new node?

Copy link
Member Author

@emmyoop emmyoop Oct 3, 2023

Choose a reason for hiding this comment

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

@QMalcolm specifically because of this comment in the original issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've pinged @jtcohen6 for clarity on this. I read that comment to mean we've left the top level meta attribute on existing nodes to support backwards compatibility, but I now see that it can also be read to mean we need to add it to all new nodes for backwards compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

@emmyoop @QMalcolm I'm happy with whatever's easier here.

Strictly, we only need it for existing node types — so for all new node types (including semantic models), we only need to support it nested within config.

@emmyoop emmyoop merged commit eac13e3 into main Oct 3, 2023
50 checks passed
@emmyoop emmyoop deleted the er/8511-sm-meta branch October 3, 2023 18:08
@emmyoop emmyoop added the user docs [docs.getdbt.com] Needs better documentation label Oct 4, 2023
@FishtownBuildBot
Copy link
Collaborator

Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#4180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3042] Support meta attribute for SemanticModel nodes
4 participants