-
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
restrict python submission #5822
Changes from 9 commits
4fb6468
cc7a967
d530c27
e36a556
159b093
a8e3030
cc0923c
d3da7ef
634c815
273160c
73e5ab2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1244,6 +1244,19 @@ def selected_resources(self) -> List[str]: | |
""" | ||
return selected_resources.SELECTED_RESOURCES | ||
|
||
@contextmember | ||
def submit_python_job(self, parsed_model: Dict, compiled_code: str) -> AdapterResponse: | ||
# Check macro_stack and that the unique id is for a materialization macro | ||
if not ( | ||
self.context_macro_stack.depth == 2 | ||
and self.context_macro_stack.call_stack[1] == "macro.dbt.statement" | ||
and "materialization" in self.context_macro_stack.call_stack[0] | ||
): | ||
raise RuntimeException( | ||
f"submit_python_job is not intended to be called here, at model {parsed_model['alias']}, with macro call_stack {self.context_macro_stack.call_stack}." | ||
) | ||
return self.adapter.submit_python_job(parsed_model, compiled_code) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. QQ: Will There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is no longer available from within Jinja context, we make functions available using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
|
||
class MacroContext(ProviderContext): | ||
"""Internally, macros can be executed like nodes, with some restrictions: | ||
|
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.
@gshank the depth is being kept as 0 because of the comment in I updated