You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, our Jinja engine (wh run) combines the templating and execution of the provided query into one step. For pipelining purposes, it could be useful to enable wh render that simply returns the query, without execution.
There are two parts to this issue (for python contributors, feel free to build the python end without building the rust part):
Python: (The python library lives in the pipelines sub-directory) We'll need to write a function (perhaps render_sql_file) that takes a file, opens it, then runs whale.utils.template_query on it, returning/logging the final result. The appropriate place for this is in whale.__init__, where the run and execute_sql_file functions already live. template_query does all the hard work already, so this function is just a wrapper, just as execute_sql_file is to the run function (see both for an example of what I mean).
Python: As-is, the API is just a set of scripts that are executed from a shell by rust, so you'll have to write a script that runs the whale.render_sql_file function. See pipelines/build_script.py for an example.
Rust: you'll have to modify main.rs to create a new subcommand for the CLI, render, and then have this reference a function in lib.rs that sources the whale virtual environment in ~/.whale/libexec. I'd directly just copy over the logic from the pull subcommand or run subcommands, which do the same thing.
The text was updated successfully, but these errors were encountered:
Currently, our Jinja engine (
wh run
) combines the templating and execution of the provided query into one step. For pipelining purposes, it could be useful to enablewh render
that simply returns the query, without execution.There are two parts to this issue (for python contributors, feel free to build the python end without building the rust part):
pipelines
sub-directory) We'll need to write a function (perhapsrender_sql_file
) that takes a file, opens it, then runswhale.utils.template_query
on it, returning/logging the final result. The appropriate place for this is inwhale.__init__
, where therun
andexecute_sql_file
functions already live.template_query
does all the hard work already, so this function is just a wrapper, just asexecute_sql_file
is to therun
function (see both for an example of what I mean).whale.render_sql_file
function. Seepipelines/build_script.py
for an example.main.rs
to create a new subcommand for the CLI,render
, and then have this reference a function inlib.rs
that sources the whale virtual environment in~/.whale/libexec
. I'd directly just copy over the logic from thepull
subcommand orrun
subcommands, which do the same thing.The text was updated successfully, but these errors were encountered: