How to import Amazon Redshift datasets into CARTO
This tutorial demonstrates how to import Amazon Redshift datasets into CARTO.
The CARTO Amazon Redshift connector allows you to import datasets from an Amazon Redshift cloud data warehouse 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 Amazon Redshift dataset
- After signing into CARTO, you must select the “New dataset” option in the menu bar.
- In the “Add datasets” screen, you must choose the Amazon Redshift connector from the Database section.
- Then you must enter the credentials for your Amazon Redshift database and click the “CONNECT” button. All the parameters are mandatory.
- 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 Amazon Redshift table contains a column with GEOMETRY data type, you can import the data just by renaming that field to “the_geom”:
SELECT field1, field2, geometry_field AS the_geom FROM table
- If your Amazon Redshift table contains two columns with longitude and latitude information, you can import the data by creating a Point geometry, setting the spatial reference system ID to 4326 (WGS84) and renaming it to
SELECT *, ST_SetSRID(ST_MakePoint(lng, lat), 4326) AS the_geom FROM table
- 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 Amazon Redshift 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.