# Data connection

> For the complete documentation index, see [llms.txt](https://developers.thoughtspot.com/docs/llms.txt)

Source: https://developers.thoughtspot.com/docs/connections

# Data connection

ThoughtSpot supports connecting to external data warehouses and using these as data sources for analytics and visualizations. ThoughtSpot users can run a live query of the data directly from the following external data sources to generate the information they need:

-   [Amazon Athena](https://docs.thoughtspot.com/cloud/latest/connections-amazon-athena)
    
-   [Amazon Aurora MySQL](https://docs.thoughtspot.com/cloud/latest/connections-amazon-aurora-mysql)
    
-   [Amazon Aurora PostgreSQL](https://docs.thoughtspot.com/cloud/latest/connections-amazon-aurora-postgresql)
    
-   [Amazon RDS MySQL](https://docs.thoughtspot.com/cloud/latest/connections-amazon-rds-mysql)
    
-   [Amazon RDS PostgreSQL](https://docs.thoughtspot.com/cloud/latest/connections-amazon-rds-postgresql)
    
-   [Amazon Redshift](https://docs.thoughtspot.com/cloud/latest/connections-redshift)
    
-   [Azure Synapse](https://docs.thoughtspot.com/cloud/latest/connections-synapse)
    
-   [ClickHouse](https://docs.thoughtspot.com/cloud/latest/connections-clickhouse) Early Access
    
-   [Databricks](https://docs.thoughtspot.com/cloud/latest/connections-databricks)
    
-   [Denodo](https://docs.thoughtspot.com/cloud/latest/connections-denodo)
    
-   [Dremio](https://docs.thoughtspot.com/cloud/latest/connections-dremio)
    
-   [Generic JDBC](https://docs.thoughtspot.com/cloud/latest/connections-genericjdbc)
    
-   [Google AlloyDB for PostgreSQL](https://docs.thoughtspot.com/cloud/latest/connections-google-alloydb-postgresql)
    
-   [Google BigQuery](https://docs.thoughtspot.com/cloud/latest/connections-gbq)
    
-   [Google Cloud SQL for MySQL](https://docs.thoughtspot.com/cloud/latest/connections-google-cloud-sql-mysql)
    
-   [Google Cloud SQL for PostgreSQL](https://docs.thoughtspot.com/cloud/latest/connections-google-cloud-sql-postgresql)
    
-   [Google Cloud SQL for SQL Server](https://docs.thoughtspot.com/cloud/latest/connections-google-cloud-sql-sql-server)
    
-   [Looker](https://docs.thoughtspot.com/cloud/latest/connections-looker)
    
-   [Mode](https://docs.thoughtspot.com/cloud/latest/connections-mode)
    
-   [MySQL](https://docs.thoughtspot.com/cloud/latest/connections-mysql)
    
-   [Oracle](https://docs.thoughtspot.com/cloud/latest/connections-adw)
    
-   [PostgreSQL](https://docs.thoughtspot.com/cloud/latest/connections-postgresql)
    
-   [Presto](https://docs.thoughtspot.com/cloud/latest/connections-presto)
    
-   [SAP HANA](https://docs.thoughtspot.com/cloud/latest/connections-hana)
    
-   [SingleStore](https://docs.thoughtspot.com/cloud/latest/connections-singlestore)
    
-   [Snowflake](https://docs.thoughtspot.com/cloud/latest/connections-snowflake)
    
-   [SQL Server](https://docs.thoughtspot.com/cloud/latest/connections-sql-server)
    
-   [Starburst](https://docs.thoughtspot.com/cloud/latest/connections-starburst)
    
-   [Teradata](https://docs.thoughtspot.com/cloud/latest/connections-teradata)
    
-   [Trino](https://docs.thoughtspot.com/cloud/latest/connections-trino)
    

This article describes the procedures for setting and managing data connections through the REST APIs. For information about how to set up a data connection, see [Data Connections in ThoughtSpot](https://docs.thoughtspot.com/cloud/latest/connections).

## Data Connection APIs

The connection API endpoints allow you to create, edit, delete, export, and query data connections on a ThoughtSpot cluster. For more information about the API endpoints, see the following pages:

-   [REST API v1]({{navprefix}}/{{connections-api}})
    
-   [REST APIs v2](https://developers.thoughtspot.com/docs/rest-apiv2-reference#_connections)
    

### Required permissions

You must have data management permissions to create, edit, delete or query data connection objects. Make sure your user account has the `DATAMANAGEMENT` privilege.

If [Role-Based Access Control (RBAC)]({{navprefix}}/{{roles}}) is enabled on your ThoughtSpot cluster, the `CAN_CREATE_OR_EDIT_CONNECTIONS` **(Can create/edit Connections)** privilege is required.

### Configuration attributes

The configuration attributes include authentication and database information required to set up or update a data connection. For most data connections, you can use service account or OAuth credentials to connect to and fetch data from a Cloud Data Warehouse. Some data connections like Teradata, Oracle, and Presto do not support OAuth. The Snowflake connections also support external OAuth credentials with Microsoft Azure AD or Okta.

> **NOTE:** To set up connections with OAuth, make sure your connection metadata includes client ID, client secret key, auth URL, and access token URL.

Amazon Redshift connection

-   `host`
    
    _String_. The hostname of the database connection.
    
-   `port`
    
    _Integer_. Enter the port number associated with the database. The default port is 5439.
    
-   `user`
    
    _String_. Username of your Redshift account.
    
-   `password`
    
    _String_. Password of your Redshift account.
    
-   `database`
    
    _String_. Specify the name of the database that you want to use for live query..
    

To set up a **Redshift connection with OAuth**, see [Configure AWS IDC OAuth for a Redshift connection](https://docs.thoughtspot.com/cloud/latest/connections-redshift-aws-idc-oauth) and [Configure Azure AD external OAuth for a Redshift connection](https://docs.thoughtspot.com/cloud/latest/connections-redshift-azure-ad-oauth)

Azure Synapse connection

-   `host`
    
    _String_. The hostname of the database connection.
    
-   `port`
    
    _Integer_. Enter the port number associated with the database.
    
-   `user`
    
    _String_. Username of your Azure Synapse account.
    
-   `password`
    
    _String_. Password of your Azure Synapse account.
    
-   `database`
    
    _String_. Specify the database associated with the account.
    

To set up a **Synapse connection with OAuth**, see [Configure OAuth for a Synapse connection](https://docs.thoughtspot.com/cloud/latest/connections-synapse-oauth)

ClickHouse connection

-   `host`
    
    _String_. The hostname of the ClickHouse server.
    
-   `port`
    
    _Integer_. Enter the ClickHouse server port number.
    
-   `user`
    
    _String_. Username of your ClickHouse database account.
    
-   `password`
    
    _String_. Password of your ClickHouse database account.
    
-   `Connection name`
    
    _String_. Name for the new ClickHouse connection.
    

Databricks connection

-   `host`
    
    _String_. The hostname of the database connection. For example, `dbs.example.cloud.databricks.com`.
    
-   `http_path`
    
    _String_. The HTTP path of your Databricks connection host.
    
-   `user`
    
    _String_. Username of your Databricks account.
    
-   `password`
    
    _String_. Password of your Databricks account.
    

To set up a **Databricks connection with OAuth**, see [Configure OAuth for a Databricks connection](https://docs.thoughtspot.com/cloud/latest/connections-databricks-oauth).

Dremio connection

-   `host`
    
    _String_. The hostname of Dremio server.
    
-   `port`
    
    _String_. Dremio server port.
    
-   `user`
    
    _String_. Username of the Dremio server account.
    
-   `password`
    
    _String_. Password of the Dremio server account.
    
-   `database`
    
    _String_. The database associated with the account.
    

To set up a **Dremio connection with OAuth**, see [Configure OAuth for a Dremio connection](https://docs.thoughtspot.com/cloud/latest/connections-dremio-oauth).

Denodo connection

-   `host`
    
    _String_. The hostname of Denodo server.
    
-   `port`
    
    _String_. Denodo server port.
    
-   `user`
    
    _String_. Username of the Denodo server account.
    
-   `password`
    
    _String_. Password of the Denodo server account.
    
-   `database`
    
    _String_. The database associated with the account.
    

To set up a **Denodo connection with OAuth**, see [Configure OAuth for a Denodo connection](https://docs.thoughtspot.com/cloud/latest/connections-denodo-oauth).

The following example shows the connection metadata JSON for a Denodo connection:

```JSON
{
  "configuration": {
    "host": "10.79.153.40",
    "port": "9999",
    "user": "admin",
    "password": "admin",
    "database": "thoughtspot_sales"
  },
  "externalDatabases": [
  ]
}
```

Google BigQuery connection

-   `project_id`
    
    _String_. ID of the project associated with your BigQuery account.
    
-   `oauth_pvt_key`
    
    _String_. The secret key obtained for your BigQuery service account. To obtain the secret key, you must create a custom role in BigQuery and set up your service account. For more information, see [BigQuery prerequisites](https://docs.thoughtspot.com/cloud/latest/connections-gbq-prerequisites).
    

To set up a **BigQuery connection with OAuth**, see [Configure OAuth for a Google BigQuery connection](https://docs.thoughtspot.com/cloud/latest/connections-gbq-oauth).

Looker connection

-   `host`
    
    _String_. The hostname of Looker server.
    
-   `password`
    
    _String_. Password of the Looker server account.
    
-   `user`
    
    _String_. Username of the Looker server account.
    

To set up a **Looker connection with OAuth**, see [Connecting to Looker](https://docs.thoughtspot.com/cloud/latest/connections-looker-add#_connecting_to_looker).

Mode connection

-   `host`
    
    _String_. The hostname of Mode server. Enter `production-datawarehouse.mode.com`
    
-   `port`
    
    _String_. Mode server port. Enter `8444`
    
-   `user`
    
    _String_. Username of the Mode server account.
    
-   `password`
    
    _String_. Password of the Mode server account.
    

Oracle connection

-   `user`
    
    _String_. Username of your Oracle account.
    
-   `password`
    
    _String_. Password of your Oracle account.
    
-   `net_service_name`
    
    _String_. The Net Service Name of your Oracle account.
    
-   `wallet_file`
    
    _String_. The file containing your Oracle client credentials.
    

-   `schema`
    
    _String_. The schema of the database.
    

Presto connection

-   `host`
    
    _String_. Hostname of the Presto database.
    
-   `port`
    
    _String_. Presto server port.
    
-   `user`
    
    _String_. Username of your Presto database user.
    
-   `password`
    
    _String_. Password of your Presto database user.
    
-   `database`
    
    _String_. The database to fetch tables from.
    

SAP HANA connection

-   `host and port`
    
    _String_. The hostname and port of the SAP HANA database connection. Enter the host followed by a colon and the port number of the SAP HANA database. For example, if your host is 192.168.1.1, and your port is 8080, specify `192.168.1.1:8080`.
    
-   `user`
    
    _String_. Username of your SAP HANA database account.
    
-   `password`
    
    _String_. Password of your SAP HANA database account.
    
-   `database`
    
    _String_. The database associated with the SAP HANA database.
    

Starburst connection

-   `host`
    
    _String_. Hostname of the database connection.
    
-   `port`
    
    _String_. Starburst server port.
    
-   `user`
    
    _String_. Username of your Starburst account.
    
-   `password`
    
    _String_. Password of your Starburst account.
    
-   `database`
    
    _String_. The database from which you want to fetch tables.
    

To set up a **Starburst connection with OAuth**, see [Configure OAuth for a Starburst connection](https://docs.thoughtspot.com/cloud/latest/connections-starburst-oauth)

Snowflake connection

-   `accountName`
    
    _String_. The service account name associated with the Snowflake connection.
    
-   `user`
    
    _String_. The Snowflake account username.
    
-   `password`
    
    _String_. The password of your Snowflake account.
    
-   `role`
    
    _String_. The role assigned to your user account. For example, `sysadmin`.
    
    Make sure the role you specify for this attribute has privileges to access the database, schema, and tables that you want to use for the live query service.
    
-   `warehouse`
    
    _String_. Data warehouse from which you want to fetch data.
    
-   `database`
    
    _String_. The database associated with the Snowflake database.
    

To set up a **Snowflake connection with OAuth**, see [Configure internal OAuth for a Snowflake connection](https://docs.thoughtspot.com/cloud/latest/connections-snowflake-oauth).

Teradata connection

-   `host`
    
    _String_. The hostname of the database connection.
    
-   `user`
    
    _String_. Username of the Teradata database user.
    
-   `password`
    
    _String_. Password of the Teradata database user.
    
-   `database`
    
    _String_. Database from which you want to fetch tables.
    

Trino connection

-   `host`
    
    _String_. Hostname of the Trino database.
    
-   `port`
    
    _String_. Starburst server port.
    
-   `user`
    
    _String_. Username of the Trino database user.
    
-   `password`
    
    _String_. Password of the Trino database user.
    
-   `database`
    
    _String_. The Database from which you want to fetch tables.
    

### Connection attributes

To create or modify data connections through REST APIs, you need to provide a map of JSON attributes. This JSON includes configuration attributes and a map of the database schema with tables.

#### Example JSON with connection attributes - with tables

```JavaScript
{
   "configuration":{
      "accountName":"thoughtspot_partner",
      "user":"tsadmin",
      "password":"TestConn123",
      "role":"sysadmin",
      "warehouse":"MEDIUM_WH"
   },
   "externalDatabases":[
      {
         "name":"AllDatatypes",
         "isAutoCreated":false,
         "schemas":[
            {
               "name":"alldatatypes",
               "tables":[
                  {
                     "name":"allDatatypes",
                     "type":"TABLE",
                     "description":"",
                     "selected":true,
                     "linked":true,
                     "columns":[
                        {
                           "name":"CNUMBER",
                           "type":"INT64",
                           "canImport":true,
                           "selected":true,
                           "isLinkedActive":true,
                           "isImported":false,
                           "tableName":"allDatatypes",
                           "schemaName":"alldatatypes",
                           "dbName":"AllDatatypes"
                        },
                        {
                           "name":"CDECIMAL",
                           "type":"INT64",
                           "canImport":true,
                           "selected":true,
                           "isLinkedActive":true,
                           "isImported":false,
                           "tableName":"allDatatypes",
                           "schemaName":"alldatatypes",
                           "dbName":"AllDatatypes"
                        }
                     ]
                  }
               ]
            }
         ]
      }
   ]
}
  "validate": true
}
```

#### Example JSON with connection attributes - without tables

```JavaScript
{
   "configuration":{
      "accountName":"thoughtspot_partner",
      "user":"tsadmin",
      "password":"TestConn123",
      "role":"sysadmin",
      "warehouse":"MEDIUM_WH"
   },
   "externalDatabases":[

   ]
}
  "validate": false
}
```

## Integrate with dbt

ThoughtSpot’s dbt sync allows you to easily provide your existing dbt models and automatically create ThoughtSpot Worksheets, which you can use to search your data. Integration with dbt is certified only for Amazon Redshift, Databricks, Google BigQuery, and Snowflake connections.

For information on integrating with dbt using the **Data Workspace** option in the UI, see [Integrate with dbt](https://docs.thoughtspot.com/cloud/latest/dbt-integration).

To understand the API endpoints for establishing a dbt connection, see [REST APIs v2](https://developers.thoughtspot.com/docs/rest-apiv2-reference#_dbt).

## Data catalog integration

ThoughtSpot supports integration with only one data catalog tool at a time. You must have `CAN_CREATE_CATALOG` permissions to establish a data catalog connection. To understand about the data catalog tools supported by ThoughtSpot, see the following pages:

-   [Alation](https://docs.thoughtspot.com/cloud/latest/catalog-integration)
    
-   [Atlan](https://docs.thoughtspot.com/cloud/latest/catalog-integration-atlan)
    
-   [Collibra](https://docs.thoughtspot.com/cloud/latest/catalog-integration-collibra)
    

To understand the metadata API endpoints, see the following pages:

-   [REST APIs v1](https://developers.thoughtspot.com/docs/catalog-and-audit)
    
-   [REST APIs v2](https://developers.thoughtspot.com/docs/rest-apiv2-reference#_metadata)
    

## Connection Configuration

ThoughtSpot supports multiple configurations per data Connection. This feature allows data engineers to define and manage several distinct Connection configurations under a single data Connection object in ThoughtSpot.

For more information about this feature and its APIs, see [Connection Configuration]({{navprefix}}/{{connection-config}}).

## Custom Calendar

ThoughtSpot supports creation and management of custom calendars for a given Connection object. For more information, see the following APIs and related documentation in the REST API v2 Playground:

-   `POST /api/rest/2.0/calendars/create`  
    Creates a custom calendar.
    
-   `POST /api/rest/2.0/calendars/generate-csv`  
    Exports a custom calendar in the CSV format.
    
-   `POST /api/rest/2.0/calendars/search`  
    Gets custom calendars for the connection ID specified in the API request.
    
-   `POST /api/rest/2.0/calendars/{calendar_identifier}/delete`  
    Deletes a custom calendar.
    
-   `POST /api/rest/2.0/calendars/{calendar_identifier}/update`  
    Updates a custom calendar.