Running queries from Builder
Last updated
Last updated
Once you have created your Postgres connection in the CARTO Workspace (see Getting Access for details), you can create custom SQL layers in Builder that make use of the Analytics Toolbox for Postgres.
To get started, let’s run a simple example query to subdivide the area into Quadbin grid cells using the QUADBIN_POLYFILL
function from the quadbin 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 Postgres 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:
You can also take advantage of the function directly from a table from your database and combine it with other functions, such as the QUADBIN_BOUNDARY
function, to get the geography boundary for a given quadbin:
Run the first query. In this example we will showcase how to get the quadbin representationat at resolution level 9 for the geographic coordinates of four US cities dusing the QUADBIN_POLYFILL
function.
Try executing any of the queries included in every function definition in the SQL Reference.