Running queries from Builder
Last updated
Last updated
To run this example you'll need:
An active CARTO organization
The latest version of the Analytics Toolbox installed in your Snowflake database
Once you have gained access to the Analytics Toolbox through the Snowflake Data Marketplace (see Getting Access for details), you can create custom SQL layers in Builder that make use of any of the available spatial functions.
To get started, let’s run a simple example query to cluster a set of points using the ST_CLUSTERKMEANS
function from the clustering module.
Click on the Add source from button in Builder, that can be found at the bottom left of the screen.
Select the second tab Custom Query (SQL) and pick the Snowflake connection that you will use to run the query. Please make sure this connection has access to the Analytics Toolbox database.
Click on Add source. A SQL console will be displayed.
Copy and paste the following query:
Run the query. This query computes eight clusters from the points of the starbucks_locations_usa
table, provided as sample data within the Analytics Toolbox. As a result, each point is assigned a cluster
ID.
Style the layer by the cluster
attribute.
For more examples, visit the Examples section or try executing any of the queries included in every function definition in the SQL Reference.