Manual installation in your own project
The manual installation of the Analytics Toolbox is recommended to support other regions required for your project or make the toolbox available inside a Virtual Private Cloud (VPC).
This guide will use Google Cloud Shell to set up and install the toolbox. Please open the GCP console and select the project to install the toolbox, then use the “>_” button (top right) to “Activate Cloud Shell”.
All following commands and instructions should be executed from the Cloud Shell in your console or from authenticated gcloud
and bq
CLI sessions.
Setup
This step consists of setting up the BigQuery project where you want to install the toolbox. A Google account is required.
Prepare the resources
You will need a GCP project to install the toolbox, as well as a storage bucket in the same project to store the JavasScript libraries needed. Users of the toolbox will need permission to read both the BigQuery dataset (where the functions and procedures will be installed) and the bucket in order to run the CARTO Analytics Toolbox.
We will set the project and bucket names as well as the location where the toolbox will be created (which should be the same as the bucket) as Cloud Shell environment variables:
PROJECT: Project id where the toolbox dataset will be created
REGION: Location of the BigQuery dataset that will be created to install the Analytics Toolbox
BUCKET: Name of the bucket to store the JavasScript libraries needed by the toolbox (please omit any protocol prefix like gs://)
Set these variables by executing the following in Cloud Shell (after replacing the appropriate values):
Creating the dataset
This step is only required before the first installation. Activate the Cloud Shell in the target project and ensure the environment variables from the preparation step above are set.
Before starting the process make sure the target GCP project exists and that it is the correct one by executing the following:
Then, create a BigQuery dataset named carto
, where the Analytics Toolbox will be installed:
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.
Prepare the package
Please reach out to our Support team in order to get access to the installation package.
The CARTO team will provide a zip that contains the scripts to install the analytics toolbox:
License file
modules.sql
fileLibs directory with the JS files
Take a look at this documentation if you need help uploading the package to your Cloud Shell. Once you're all set with that, run the following commands:
Create catalog tables and variables
The data module function uses the spatial catalog tables. Running the following commands, those tables are created in the carto
dataset. When subscriptions are provisioned, the catalog tables will be updated.
Copy the libraries
This command installs the JavaScript libraries for the Analytics Toolbox in the selected bucket. These libraries will be used in runtime by the functions.
Create the functions and procedures
This command installs the functions and procedures of the Analytics Toolbox in the selected project. This operation takes a few minutes to complete.
The installation process might take up to 5 minutes.
Please be aware that this script will remove all the previous functions and procedures in the carto
schema.
AT Gateway
Some functionalities of the CARTO Analytics Toolbox for BigQuery require making external calls from BigQuery to CARTO services. These calls are implemented via BigQuery Remote Functions:
Creation of isolines, geocoding and routing require making calls to CARTO LDS API. In order to call this API, BigQuery needs a connection and a Cloud Run function that works as proxy.
Some other functions of the Analytics Toolbox require making a request to the CARTO Platform backend. For this purpose, CARTO provides Cloud Run functions on different regions.
These services are readily available when using the Analytics Toolbox from a CARTO maintained project, but when installing the Analytics Toolbox manually in your own project, there is some configuration required:
Create a BigQuery connection that will allow to call Cloud Run functions from BigQuery.
Select an AT Gateway endpoint that is in the same region as your project.
If you are installing a CARTO Self Hosted in a Google Cloud VPC, please refer to this section to learn how to provision the AT Gateway in your VPC before proceeding with this part of the configuration.
Create a BigQuery connection
As mentioned above, BigQuery connections are used for running remote functions from BigQuery.
Create a connection with the command below. Please note that bigquery.connections.delegate
permission will be required:
Export the CONNECTION
variable:
Find an AT Gateway endpoint
At this point, if you're installing the Analytics Toolbox in a Google Cloud VPC, please refer to this section.
From this table, find the AT Gateway endpoint that correspond with your region. For US and EU multi-regions, choose any US or EU endpoint.
carto-analytics-toolbox
atgwfunc-as-ea1-7604
asia-east1
carto-analytics-toolbox
atgwfunc-as-ea2-9555
asia-east2
carto-analytics-toolbox
atgwfunc-as-ne1-7871
asia-northeast1
carto-analytics-toolbox
atgwfunc-as-ne2-3699
asia-northeast2
carto-analytics-toolbox
atgwfunc-as-ne3-9803
asia-northeast3
carto-analytics-toolbox
atgwfunc-as-se1-9008
asia-southeast1
carto-analytics-toolbox
atgwfunc-as-se2-9937
asia-southeast2
carto-analytics-toolbox
atgwfunc-as-so1-7788
asia-south1
carto-analytics-toolbox
atgwfunc-as-so2-6443
asia-south2
carto-analytics-toolbox
atgwfunc-au-se1-2301
australia-southeast1
carto-analytics-toolbox
atgwfunc-au-se2-9274
australia-southeast2
carto-analytics-toolbox
atgwfunc-eu-ce2-6914
europe-central2
carto-analytics-toolbox
atgwfunc-eu-no1-6484
europe-north1
carto-analytics-toolbox
atgwfunc-eu-sw1-1259
europe-southwest1
carto-analytics-toolbox
atgwfunc-eu-we1-1809
europe-west1
carto-analytics-toolbox
atgwfunc-eu-we12-743
europe-west12
carto-analytics-toolbox
atgwfunc-eu-we2-9846
europe-west2
carto-analytics-toolbox
atgwfunc-eu-we3-9705
europe-west3
carto-analytics-toolbox
atgwfunc-eu-we4-4558
europe-west4
carto-analytics-toolbox
atgwfunc-eu-we6-5628
europe-west6
carto-analytics-toolbox
atgwfunc-eu-we9-8712
europe-west9
carto-analytics-toolbox
atgwfunc-me-ce1-6804
me-central1
carto-analytics-toolbox
atgwfunc-me-we1-8177
me-west1
carto-analytics-toolbox
atgwfunc-na-ne1-9070
northamerica-northeast1
carto-analytics-toolbox
atgwfunc-na-ne2-1664
northamerica-northeast2
carto-analytics-toolbox
atgwfunc-sa-ea1-5299
southamerica-east1
carto-analytics-toolbox
atgwfunc-sa-we1-1940
southamerica-west1
carto-analytics-toolbox
atgwfunc-us-ce1-4566
us-central1
carto-analytics-toolbox
atgwfunc-us-ea1-8111
us-east1
carto-analytics-toolbox
atgwfunc-us-ea4-8568
us-east4
carto-analytics-toolbox
atgwfunc-us-we1-4218
us-west1
carto-analytics-toolbox
atgwfunc-us-we2-3390
us-west2
carto-analytics-toolbox
atgwfunc-us-we3-1834
us-west3
carto-analytics-toolbox
atgwfunc-us-we4-1057
us-west4
Export the GATEWAY_ENDPOINT
variable:
Find CARTO LDS API connection details
In order to use the functions in the lds module, you need to get the API Base URL and LDS Token from your CARTO account.
To get the API Base URL, go to the “Developers” section in the CARTO Platform and copy the value. For more information, check the documentation.
To get the LDS Token, go to the “Developers” section and create a new API Access Token. For more information, check the documentation. Make sure your token has LDS API enabled:
Let's export those values as variables:
Run the SETUP procedure
Now that we have collected all the necessary parameters, we can call the SETUP
procedure to have our own installation of the Analytics Toolbox ready and available:
After running the previous query, the CARTO Analytics Toolbox should be ready to work in your BigQuery project. In order to check if the installation process has worked as expected, you can execute the following queries in the BigQuery console. It will create a table called geocode_test_table
containing a gecoded address.
🎉Congratulations! If the previous query execution finishes and you can obtain the geocoded address querying the table that has been created your installation is complete. Now, remember to setup your connections to BigQuery with the correct Analytics Toolbox location setting to ensure that all queries generated by CARTO applications use it.
After an installation or update of the Analytics Toolbox is performed, the CARTO connection needs to refreshed by the owner of the connection by clicking on the refresh button on the connection's card.
Last updated