This is the implementation of the Redshift data handler for MindsDB.

Amazon Redshift is a fully managed, petabyte-scale data warehouse service in the cloud. You can start with just a few hundred gigabytes of data and scale to a petabyte or more, enabling you to use your data to acquire new insights for your business and customers.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or use MindsDB Cloud.
  2. To connect Amazon Redshift to MindsDB, install the required dependencies following this instruction.
  3. Install or ensure access to Amazon Redshift.

Implementation

This handler is implemented using the redshift_connector library that is provided by Amazon Web Services.

The required arguments to establish a connection are as follows:

  • host is the host name or IP address of the Redshift cluster.
  • port is the port to use when connecting with the Redshift cluster.
  • database is the database name to use when connecting with the Redshift cluster.
  • user is the username to authenticate the user with the Redshift cluster.
  • password is the password to authenticate the user with the Redshift cluster.

Usage

Before attempting to connect the Redshift database to MindsDB, ensure that it accepts incoming connections. Here is a guide for troubleshooting Redshift database connections.

To connect to the Redshift database in MindsDB using this handler, use the following syntax:

CREATE DATABASE redshift_datasource
WITH
  engine = 'redshift',
  parameters = {
    "host": "examplecluster.abc123xyz789.us-west-1.redshift.amazonaws.com",
    "port": 5439,
    "database": "example_db",
    "user": "awsuser",
    "password": "my_password"
  };

Once this connection has been established, you can query your table as follows:

SELECT *
FROM redshift_datasource.example_tbl;