Load data from Snowflake
Learn how to connect to Snowflake with Exasol and then load data.
Prerequisites
-
Snowflake must be reachable from the Exasol system.
-
The user credentials in the connection must be valid.
Download driver
Download the latest JDBC driver from the Snowflake website.
Add JDBC driver
-
Create a configuration file
settings.cfgwith the following settings:CopyDRIVERNAME=Snowflake
PREFIX=jdbc:snowflake:
FETCHSIZE=100000
INSERTSIZE=-1
NOSECURITY=YESThe file must end with an empty line (line break followed by zero characters).
-
Upload the settings.cfg file and the driver .jar file to BucketFS in the Exasol cluster.
In Exasol 2025.1 and later you can upload files using Exasol Admin. You can also use any compatible file transfer tool, including curl on the command line. See also Manage files in BucketFS.
In Exasol SaaS you must upload the driver through the web console.
If the driver was downloaded as a .tar.gz or .zip archive, make sure that you extract and upload only the .jar file along with the settings.cfg file.
Example (using curl in Linux):
Copyexport WRITE_PW=<your_bucketfs_write_password>
export DATABASE_NODE_IP=<ip_address_of_cluster_node>
export PORT=<bucketfs_port> # default: 2581
curl -v --insecure -X PUT -T settings.cfg https://w:$WRITE_PW@$DATABASE_NODE_IP:$PORT/default/drivers/jdbc/exasol/settings.cfg
curl -v --insecure -X PUT -T exajdbc.jar https://w:$WRITE_PW@$DATABASE_NODE_IP:$PORT/default/drivers/jdbc/exasol/exajdbc.jarThe option
--insecureor-ktells curl to bypass the TLS certificate check. This option allows you to connect to a HTTPS server that does not have a valid certificate. Only use this option if certificate verification is not possible and you trust the server.
-
For more details about how to add JDBC drivers and configuration files, see Add JDBC driver.
-
To learn more about how to upload files to BucketFS, see Manage files in BucketFS.
Create connection
To create a connection, run the following statement. Replace the placeholders in the connection string and credentials with the corresponding values for your Snowflake account.
-- Create a connection to Snowflake
CREATE OR REPLACE CONNECTION SNOWFLAKE_CONNECTION
TO 'jdbc:snowflake://<myorganization>-<myaccount>.snowflakecomputing.com/?warehouse=<my_compute_wh>&role=<my_role>&CLIENT_SESSION_KEEP_ALIVE=true&JDBC_QUERY_RESULT_FORMAT=JSON'
USER '<sfuser>' IDENTIFIED BY '<sfpwd>';
The parameter JDBC_QUERY_RESULT_FORMAT=JSON is required to specify JSON format for the returned query results. Snowflake will otherwise default to Arrow format, which will result in an error.
To test the connection, run the following statement.
SELECT * FROM
(
IMPORT FROM jdbc AT SNOWFLAKE_CONNECTION
STATEMENT 'select ''Connection works!'' as connection_status'
);
Load data
Use IMPORT to load data from a table or SQL statement using the connection that you created.