Use run_query
to execute a multiple-statement block with BEGIN-END (i.e. create procedure)
#10810
lucianmoldovanu
started this conversation in
General
Replies: 2 comments 1 reply
-
Running into this as well, especially unfortunate as this would've allowed us to use the new ASYNC code blocks in macro's :( |
Beta Was this translation helpful? Give feedback.
0 replies
-
Just in case anybody runs into this issue as well, this can be solved by using an anonymous block code block. I found that So this macro performs as expected:
Output: C:\\dbt>dbt run-operation test_macro
14:11:58 Running with dbt=1.9.1
14:11:59 Registered adapter: snowflake=1.9.0
14:12:01 Found 14 models, 4 snapshots, 3 seeds, 5 operations, 5 sources, 702 macros
14:12:03 Result of query: Execution completed successfully. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to have
run_query
in Jinja create a procedure in the Snowflake target warehouse (conditional on some inputs being satisfied).The code of the procedure is generic:
The problem is that when using
run_query
the semicolon after <statement 1> is taken as a separator and the following code is attempted to be run (which obviously fails because it's incomplete).I have tried using the lower-level approach, yet this encounters the same issue:
I am using DBT core ~1.8 &
dbt-snowflake
adapter.Am I missing something in DBT docs that would enable me to run such code without it being broken down? This is applicable to i.e.
create procedure
,create task
etc in Snowflake. In general wherever a BEGIN-END block makes sense to define a block of multiple statements.Beta Was this translation helpful? Give feedback.
All reactions