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

shanila
shanila New Altair Community Member
edited November 2024 in Community Q&A
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'.

Tagged:

Answers

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member
    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