How to import Snowflake datasets into CARTO
This tutorial demonstrates how to import Snowflake datasets into CARTO.
The CARTO Snowflake connector allows you to import datasets from the Snowflake cloud data platform into CARTO. You can then use CARTO to create easy-to-share map dashboards, perform spatial data science analysis or create spatial applications.
Importing your Snowflake dataset
- After signing into to CARTO, you must select the “New dataset” option in the menu bar.
- In the “Add datasets” screen, you must choose the Snowflake connector from the Database section.
- Then you must enter the credentials for your Snowflake database. All the parameters are mandatory except “Warehouse”, which is optional.
- Once the credentials have been verified, you need to enter a SQL Query to select the data that you want to import and the name you want for the new dataset:
- If your Snowflake table contains a column with GEOGRAPHY data type, you can import the data by converting it to WKT format and renaming it to “the_geom”:
SELECT *, ST_ASWKT(geography_field) AS the_geom FROM table
- If your Snowflake table contains two columns with longitude and latitude information, you can import the data by creating a Point GEOGRAPHY, converting it to WKT format and renaming it to
SELECT *, ST_ASWKT(ST_MAKEPOINT(lng, lat)) AS the_geom FROM table
Directly importing a table containing a GEOGRAPHY field without converting it to WKT is not supported yet.
When you have specified your SQL query and the name for your new dataset, the “RUN SQL QUERY” button becomes enabled. When you click this button, the next screen lets you specify the frequency for updating your CARTO dataset if you’d like to keep it in sync with the Snowflake table.
- Finally, you must click the “CONNECT DATASET” button to begin the import operation. When the operation finishes, you will be presented with a preview of the dataset. From this screen you can directly create a map with your imported dataset.