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:
Connection types
There are 2 kinds of data sources that do not require a connection instance:
Function
You can define secrets (key/value) that can later be accessed in the function datasource query:
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:
Create a new Google Cloud project - instructions.
Generate Oauth 2.0 credentials - instructions.
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.
Add the following URIs under Authorized Redirect URIs:
https://<YOUR_APP_URL>/api/dataSources/googleSheets/auth/callback</YOUR_APP_URL>
Enable the Google Sheets and Google Drive APIs for the project - instructions.
Connect your google account
- Once you create Google Sheets type connection click CONNECT button:
Choose the Google account that you want to authorize.
Grant access to your Google Drive files by clicking Allow.
Once you successfully connect your account you should see a button stating the account that was connected.
PostgreSQL
To query data from a PostgreSQL database, you must configure the connection:
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.