-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Schema yaml rendering and source overrides #2357
Conversation
00515f9
to
bd48904
Compare
core/dbt/contracts/graph/manifest.py
Outdated
|
||
def build_flat_graph(self): | ||
"""This attribute is used in context.common by each node, so we want to | ||
only build it once and avoid any concurrency issues around it. | ||
Make sure you don't call this until you're done with building your | ||
manifest! | ||
""" | ||
# TODO: we could supply sources in nodes here, for backwards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to do this - interested in feedback on it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to break the existing contract here - using graph.nodes
is pretty niche and we can call it out in the release notes / migration guide. I feel great about requiring users to go through graph.sources
instead of graph.nodes
, as many of the nodes in graph.nodes
are going to be poorly constructed at parse-time.
Check out the big disclaimer here for more info: https://docs.getdbt.com/docs/writing-code-in-dbt/jinja-context/graph/
afbbf59
to
6199871
Compare
aa93347
to
52cf845
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really great! Couple of pieces of feedback from playing around with this locally:
Can we add a warning message if a source patch overrides a source which does not exist? This was actually user I encountered while testing, and it would have been really helpful to see a warning.
I see a stack trace when trying to run dbt source snapshot-freshness
:
User Error
I'll keep testing this, but wanted to send this initial feedback through sooner rather than later. Overall this is very, very good!!
core/dbt/contracts/graph/manifest.py
Outdated
|
||
def build_flat_graph(self): | ||
"""This attribute is used in context.common by each node, so we want to | ||
only build it once and avoid any concurrency issues around it. | ||
Make sure you don't call this until you're done with building your | ||
manifest! | ||
""" | ||
# TODO: we could supply sources in nodes here, for backwards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to break the existing contract here - using graph.nodes
is pretty niche and we can call it out in the release notes / migration guide. I feel great about requiring users to go through graph.sources
instead of graph.nodes
, as many of the nodes in graph.nodes
are going to be poorly constructed at parse-time.
Check out the big disclaimer here for more info: https://docs.getdbt.com/docs/writing-code-in-dbt/jinja-context/graph/
self.flat_graph = { | ||
'nodes': { | ||
k: v.to_dict(omit_none=False) for k, v in self.nodes.items() | ||
}, | ||
'sources': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Yes, definitely, great idea |
I think we've lost sources in the catalog. Can you update the |
fcdca0f
to
54c9bc4
Compare
The SchemaParser now renders the entire schema.yml except tests/descriptions Snapshot config resolution
Add/modify tests to test native rendering/config application
Handle quoting in render() instead of get_rendered code - avoid stripping the quotes from a string that was returned as jinja
54c9bc4
to
ed2fb08
Compare
- add paths to source patches, apply them to parsed source definitions - warn on unused source patches - fix error on duplicate source patches - add sources back into the catalog - update changelog
Fix tests accordingly
ed2fb08
to
d383441
Compare
@drewbanin I believe I've addressed all the PR feedback. |
c228f5e
to
0b82def
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - ship it!
resolves #2269
resolves #2283
resolves #2287
Description
This PR accomplishes a few related tasks:
overrides
nodes
andsources
Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.