Unable to run 'USE DATABASE' or 'USE WAREHOUSE' statement for Snowflake

shanilashanila Member Posts: 6 Contributor I
USE WAREHOUSE WAREHOUSENAME
SELECT *
FROM "RAPIDMINER"."PUBLIC"."AUTHORDATASET" Exception: com.rapidminer.core.io.data.DataSetException Message: SQL compilation error: syntax error line 2 at position 0 unexpected 'SELECT'.

Answers

  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi!

    This is an incorrect SQL statement. It might work in a special frontend that automatically separates Snowflake specific commands like USE from the other commands, but in this context it's not syntactically correct.

    Most databases use the semicolon to separate commands:

    USE WAREHOUSE WAREHOUSENAME;
    
    SELECT *
    FROM ...
    ;

    Check the documentation of your database for the separator character.
    It is still possible that it won't work, because somewhere between RapidMiner, the JDBC driver and the database some component doesn't accept multiple commands in one statement.

    In that case your best option is to specify the warehouse inside the connection object instead of changing it dynamically in the SQL statement.

    Regards,
    Balázs
Sign In or Register to comment.