Core version

Setup

This step consists of setting up the Postgres database where we want to install the toolbox.

A PostgreSQL database is required (RDS, Aurora, Cloud SQL, Azure, etc.)

Installing extensions

The CARTO Analytics Toolbox makes use of the PostGIS extension. Make sure you have this extension installed in your database. Run the following query to enable the extension.

CREATE EXTENSION postgis;

Some modules require additional extensions. In case you want to make use of them, make sure you have the corresponding extension installed in your database. Run the following query to enable the extensions.

CREATE EXTENSION plv8; -- Required only by H3

Creating the schema

We’ll create a schema named “carto” in the database where you want the CARTO Analytics Toolbox installed. We also recommend creating a dedicated Postgres user called “carto” to manage the CARTO Analytics Toolbox.

To do this, connect to your PostgreSQL database and run the following script:

-- Create the carto schema
CREATE SCHEMA carto;

-- Grant usage to public role
GRANT USAGE ON SCHEMA carto TO public;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA carto TO public;
GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA carto TO public;

Installation

Once the setup is completed, we can proceed with the installation of the toolbox. This step will be performed the first time and every time we want to install an updated version.

Download the package

This zip file contains the scripts to install the Core version of the Analytics Toolbox. Unzip the content in your local storage. This package will contain:

  • LICENSE file

  • modules.sql file

Download the latest installation package from here

Execute the script

In the destination database, execute the script modules.sql to install the new version of functions and procedures.

WARNING: This script will remove all the previous functions and procedures in the carto schema.

Congratulations!

You have successfully installed the CARTO Analytics Toolbox in your Postgres database. Now you can start using the functions in the SQL reference.

Last updated