kestra-io / plugin-jdbc

https://kestra.io/plugins/
Apache License 2.0
10 stars 7 forks source link

Snowflake trigger not working: choosing warehouse #364

Open MarthaScheffler opened 2 weeks ago

MarthaScheffler commented 2 weeks ago

Expected Behavior

When I use the Snowflake jdbc trigger, I want to be able to choose the virtual warehouse used in that session. Either via the Kestra parameter "warehouse", or by firing several SQL commands, "USE WAREHOUSE WH; SELECT 1;" neither is working. only workaround is to give the authenticated user a default warehouse.

(the actual jdbc tasks also seem to work fine, at least for the Query I could set a warehouse and it got used)

Actual Behaviour

Error when using the Kestra parameter "warehouse":

net.snowflake.client.jdbc.SnowflakeSQLException: No active warehouse selected in the current session. Select an active warehouse with the ‘use warehouse’ command.

Error when firing 2 SQL commands in the same session:

net.snowflake.client.jdbc.SnowflakeSQLException: Actual statement count 2 did not match the desired statement count 1.

multi-statement support from Snowflake's SQL-api: https://docs.snowflake.com/en/developer-guide/sql-api/submitting-multiple-statements#specifying-multiple-sql-statements-in-the-request

Steps To Reproduce

  1. using the code from https://kestra.io/plugins/plugin-jdbc-snowflake/triggers/io.kestra.plugin.jdbc.snowflake.trigger
  2. setting additionally a warehouse
  3. changing the sql to "SELECT WAREHOUSE my_warehouse; SELECT * FROM demo_db.public.customers;"

Environment Information

Example flow

No response