Reputation: 41
I am trying to connect to snowflake DB and activate a particular warehouse.I have used warehouse in both JDBC connection
jdbc:snowflake://xy12345.eu-central-1.snowflakecomputing.com/?warehouse=mywh
as well as in the properties
options.put("warehouse", "mywh")
Is there anything else that needs to be added .
Even if I am giving an incorrect warehouse , the connection goes through which is not right . Am I missing anything or is there anyway to execute "use warehouse mywh" through spark .
Thanks
Upvotes: 0
Views: 1032
Reputation: 10109
Using the warehouse parameter on JDBC, or giving it in the properties are enough to use that warehouse. The confusion is about how JDBC driver connects to Snowflake.
When you connect to Snowflake with JDBC, JDBC driver does not run "USE WAREHOUSE" immediately. This is why you do not get any error while connecting, even you entered a wrong warehouse.
When you try to execute a SQL query, if it requires an active warehouse, the warehouse you picked will be used. In case, you entered a wrong warehouse, you get an error something like this:
Exception in thread "main" net.snowflake.client.jdbc.SnowflakeSQLException: No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.
Upvotes: 0
Reputation: 1321
Can you execute command - USE WAREHOUSE using cursor to change the warehouse usage.
Upvotes: 0