-
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
[CT-648] [Feature] Distinguish what dbt command has been executed in Jinja context #5251
Comments
Hey @SOVALINUX, have you taken a look at Kind of wondering if ( |
Agreed! I'm pretty sure that Line 129 in 0d8e061
The reason we encourage you to wrap I'm going to close the issue, since I believe it's already implemented :) |
@jeremyyeo @jtcohen6 Thank you for response! It's indeed the same thing |
@SOVALINUX Super fair! I'd be open to a new issue for renaming this field, to something more like It's called |
Is this your first time opening an issue?
Describe the Feature
Hi colleagues,
In multiple advanced cases like dbt hooks, operations and unit testing we would like to execute queries against the database and also run some state changing operations (e.g. agate table print to file)
Currently dbt doesn't gives the opportunity to avoid such misbehavior
Suggested idea is to add
executed_command
to the Jinja context storingcompile
|run
|test
|docs
etc from dbt command paletteSo all macroses for hooks and operations can use it and flexibly configure when to run and what
Same for unit testing use-cases:
dbt compile
anddbt docs
current_timestamp
function indbt_utils
to write advanced tests without changing the logicDescribe alternatives you've considered
I was trying to do workarounds using tags and relying on presence of attributes like run_result, schemas, graph nodes in the Jinja context
Some of them are working, but all of them doesn't smell good
Who will this benefit?
Looks like multiple developers are facing the same issue
So, users of hooks, operations and unit-testing will benefit
Are you interested in contributing this feature?
Yes, PR will come soon
Anything else?
Easily found several related cases
#4785
#4445
The text was updated successfully, but these errors were encountered: