Links

Redshift

Create Redshift Integration

To query a Redshift database from inside Workspace, the first step is creating an integration to connect to the database:
  • Create a new integration from the Integrations tab on the dashboard (link) or by clicking on
    in the sidebar when editing a workspace.
  • Select "Redshift".
  • Enter the credentials.
Create Redshift integration.
If you are on Workspace Basic, you have to update your database's firewall to allow incoming connections from all IP addresses.
If you are on the Workspace Premium or Workspace Teams plan, Workspace will access your database through static IP addresses. You need to whitelist these IP addresses in your database's firewall before you can query the database through Workspace.
You can only connect to a database server that is available on the internet. You can not use Workspace to connect to a database server that is running on your computer (i.e. on localhost), unless you expose this server to the internet through tools like ngrok or Tailscale.

Use our sample database

If you want to experiment with this integration but don't have a Redshift cluster lying around, you can use our sample database containing data on online ticket sales (source).
You can select the sample integration in the dropdown when you create a SQL cell. Alternatively, you can open a workspace with a sample query and visualization of the data already prepared.
Example of connecting a sample database integration

Query the database

After creating the integration, you can query the database with a SQL cell. When you're editing a workspace:
  • Click "Add SQL cell" at the bottom of the notebook (or on "Add SQL cell" when hovering on the area in between two cells).
  • Select the integration that accesses the database you want to query.
  • (Optional) Update the variable name of the data frame that will hold the result of your SQL query by updating the field behind "Available as". If you don't set this, the query result will be available as a data frame called df.
  • Write the SQL query.
  • Click "Run" in the cell menu (or use the shortcuts).
Example of a running a query against the ticket-sales integration that connects to the online_ticket_sales database introduced in the previous section. The query result is available as df.