Skip to content

Connections

A connection instance lets you reuse certain configuration details to create queries faster.

To create a new connection instance, press the + button in the Explorer menu on the left side of the interface:

Add connection

Connection types

There are 2 kinds of data sources that do not require a connection instance:

Function

Connection function

You can define secrets (key/value) that can later be accessed in the function datasource query:

Connection function

Fetch

Connection fetch

You can configure:

  • base url - url that can be shared between different queries.
  • Headers - pass custom headers with each request.
  • Authentication type - if your API is protected choose the authentication method that fits your needs:
    • Basic - adds authorization header and generates base64 encoded value for a given user credentials.
    • Bearer token - adds authorization header generates value for provided token.
    • API key - adds key/value header.

There are 2 datasources that require a connection instance:

Google Sheets

Obtain credentials

Before you create a Google Sheets connection you must first configure Toolpad app by providing Google Sheets client ID and client secret:

  1. Create a new Google Cloud project - instructions.

  2. Generate Oauth 2.0 credentials - instructions.

  3. Start Toolpad with following environment variables:

    TOOLPAD_EXTERNAL_URL=<YOUR_APP_URL>
    TOOLPAD_DATASOURCE_GOOGLESHEETS_CLIENT_ID=
    TOOLPAD_DATASOURCE_GOOGLESHEETS_CLIENT_SECRET=
    

    where YOUR_APP_URL is the URL Toolpad is hosted on.

  4. Add the following URIs under Authorized Redirect URIs:

    https://<YOUR_APP_URL>/api/dataSources/googleSheets/auth/callback</YOUR_APP_URL>
    
  5. Enable the Google Sheets and Google Drive APIs for the project - instructions.

Connect your google account

  1. Once you create Google Sheets type connection click CONNECT button:
Connection Google Sheets
  1. Choose the Google account that you want to authorize.

  2. Grant access to your Google Drive files by clicking Allow.

  3. Once you successfully connect your account you should see a button stating the account that was connected.

Google Sheets connected

PostgreSQL

To query data from a PostgreSQL database, you must configure the connection:

Connection postgres

Provide the database credentials and click TEST CONNECTION to verify that you're able to connect.

If everything is correct, click SAVE to complete the connection.

Learn more in the PostgreSQL documentation.