-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve utility of database & schema information present in on-run-end hooks #1924
Comments
Thanks for the report @dinedal - I updated the title of this issue to make it a little bit more actionable. I think the big problem here is that dbt renders out I wouldn't feel great about changing the One other thing to note here: it might be worth including information about node types. I know some folks want to grant access to snapshots and models separately - it's not currently possible to programatically differentiate between schemas that dbt built snapshots in vs. schemas the dbt built models in. Last: I think Thanks! |
This would work fine for now
It seems like #1842 is quite a large leap, would love to see dbt progress there for sure, however to just add the database to the context of the macro seems like a much smaller change? |
That information is actually available, as is the information you want (though it's available in a very clunky way): Each entry in the
That's basically what dbt does currently to generate the That said, I think it does make a lot of sense to add a I think if users want to do complicated things like think about node types, they should probably just implement something like the stuff above. Especially because you can just check the value of |
@beckjake |
Hmm. I'm not sure why that would be. I thought that might be some sort of sneaky old default lingering in dbt, but I don't see anything in the code like that. Is it possible that your profiles.yml config has |
closed by #2031 |
Describe the bug
When running
dbt run
with a profile that includes the example macro of https://docs.getdbt.com/docs/on-run-end-context and writes to multiple databases, the grants are only executed on one of the databases, not the correct database of the schemaSteps To Reproduce
Use the macro at https://docs.getdbt.com/docs/on-run-end-context
Use a
dbt_project.yml
similar to:When any model in
exports
is run, confirm that thegrant
statement fails because it attempts to run on the databasedata_warehouse
instead, wheredropbox
schema doesn't existExpected behavior
The macro should execute on the database of the schema(s) passed in
Screenshots and log output
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
OS X 10.14.5
The output of
python --version
:Python 3.7.5
Additional context
N/A
The text was updated successfully, but these errors were encountered: