Premium Feature — Available with all Premium Editions of LabKey Server. Learn more or contact LabKey.

This topic explains how to configure LabKey Server to retrieve and display data from an Amazon Redshift database as an external data source. This topic assumes you have reviewed the general guidance here and provides specific parameters and details for this database type.

The Redshift Driver

The Redshift JDBC driver is bundled with the LabKey Redshift module.

Configure the Redshift Data Source

The new external data source must have a unique JNDI name that you will use in naming the properties you will define. In the example on this page, we use "externalRedshiftDataSource", which will appear to users defining external schemas as "externalRedshift". If you have more than one external data source, give each a unique name with the DataSource suffix ("firstExternalRedshiftDataSource", "secondExternalRedshiftDataSource", etc.). Learn more here.

In the <LABKEY_HOME>/config/application.properties file, add a new section with the name of the datasource and the parameters you want to define. Provide your own <SERVER:PORT>, <DB_NAME>, <DB_USERNAME>, and <DB_PASSWORD> where indicated:

context.resources.jdbc.externalRedshiftDataSource.driverClassName=com.amazon.redshift.jdbc42.Driver
context.resources.jdbc.externalRedshiftDataSource.url=jdbc:redshift://<SERVER:PORT>/<DB_NAME>
context.resources.jdbc.externalRedshiftDataSource.username=<DB_USERNAME>
context.resources.jdbc.externalRedshiftDataSource.password=<DB_PASSWORD>

There are additional properties you can set, as shown in the template for the main "labkeyDataSource" in the application.properties file.

driverClassName

Use this as the driverClassName:

com.amazon.redshift.jdbc42.Driver

url

The url property for Redshift takes this form. Substitute the correct server/port and database name:

jdbc:redshift://<SERVER:PORT>/<DB_NAME>

validationQuery

Use "SELECT 1" as the validation query for Redshift. This is the default so does not need to be provided separately for this type of external data source:

SELECT 1

Define a New External Schema

To define a new schema from this data source see Set Up an External Schema.

Supported Functionality

Most queries that would work against a PostgreSQL data source will also work against a Redshift data source.

Of the known differences most are due to limitations of Redshift, not the LabKey SQL dialect, including:

  • GROUP_CONCAT is not supported (Redshift does not support arrays).
  • Recursive CTEs are not supported; but non-recursive CTEs are supported.
  • Most PostgreSQL pass-through methods that LabKey SQL supports will work, but any involving binary types, such as string encode(), will not work.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all