-
Notifications
You must be signed in to change notification settings - Fork 110
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
Use print for outputting codegen #86
Use print for outputting codegen #86
Conversation
@JorgenG why have you closed that PR? Is there any other way to achieve what |
@swiatek25 It seemed to be no interest in it and we have already skipped using the package and added our own implementation of this. The approach is valid, but niche. Outputting to file has it's challenges. Regardless, I'll reopen the PR if there seems to be interest in it. |
Hello, I have been struggling for days now to figure out how to output to a file instead of the standard output, and finally started investigating the codegen repo and found this PR. I would like to say that I am very interested in this feature, at the moment it is impossible to pipe output into a file (below is an example of what gets piped to the file instead):
So I just wanted to contribute my opinion that this would be a very desirable feature as the capability of outputting to a file would remove a lot of necessary manual effort when using codegen. |
@jenna-jordan I worked around it by creating a wrapper macro that simply prints returned value from codegen macro.
That is surely not perfect but considering I use a small subset of codegen macros it is acceptable. Nevertheless I'm still voting for this PR. |
@swiatek25 how would you call this macro as a dbt run operation within a shell script? |
note |
@joellabes are you still looking after this repo, this seems like a good QOL addition (folks seem to be working around it right now). Also https://github.com/dbt-labs/dbt-codegen/blob/main/dbt_project.yml#L4 needs to be bumped to >=1.1.0 to get the print feature in. |
This is a:
main
dev/
branchdev/
branchDescription & motivation
This PR switches from using the
log
function to using theprint
function. The main motivation for doing this is to enable piping the output from a codegen run operation command directly into the target file, instead of copy pasting.Example:
dbt --quiet run-operation generate_model_yaml --args '{"model_name": "stg_jaffle_shop__orders"}' > models/staging/jaffle_shop/stg_jaffle_shop__orders.yml
This would also enable further automation, i.e. generating model yaml for all files in a directory etc.
Should resolve #56 and #71
Checklist