Amazon Redshift Driver v1.2.1¶
Driver Version v1.2.1 Tested With Amazon Redshift aws
This driver provides access to Amazon Redshift (commonly referred to as just “Redshift”).
Note
This project is not affiliated with Amazon.
Installation¶
The Redshift driver can be installed with dbc :
dbc install redshift
Connecting¶
To connect, edit the uri, redshift.cluster_type, redshift.workgroup_name, and redshift.db_name options below to match your environment and run the following:
from adbc_driver_manager import dbapi
dbapi.connect(
driver="redshift",
db_kwargs={
"uri": "postgresql://localhost:5439",
#"uri": "postgresql://<cluster hostname>:<cluster port>", # for direct connection
"redshift.cluster_type": "redshift-serverless", # for Redshift Serverless
#"redshift.cluster_type": "redshift-iam", # for Redshift Provisioned with IAM auth
#"redshift.cluster_type": "redshift", # for Redshift Provisioned with user/password auth
"redshift.workgroup_name": "<WORKGROUP_NAME>", # for Redshift Serverless
#"redshift.cluster_identifier": "<CLUSTER IDENTIFIER>", # for Redshift Provisioned
"redshift.db_name": "sample_data_dev",
}
)
Note: The example above is for Python using the adbc-driver-manager package but the process will be similar for other driver managers.
Connection String Format¶
Connection strings are passed with the uri option. Redshift’s URI syntax supports two primary forms:
Explicit endpoint, for direct connections or standard user/password authentication:
redshift://[user[:password]@]host[:port]/dbname[?param1=value1¶m2=value2]
Endpoint discovery, for IAM authentication and serverless connections:
redshift:///dbname[?param1=value1¶m2=value2]
Note the triple slash (
///). This indicates an empty host, signaling the driver to discover the endpoint using the provided query parameters (e.g.,cluster_identifierorworkgroup_name).
Components:
Scheme: redshift:// (required)
User/Password: Optional (for standard user/password authentication with
cluster_type=redshift)Ignored if cluster_type is
redshift-iamorredshift-serverless
Host/Port: The Redshift cluster endpoint (e.g., my-cluster.c…com:5439)
If omitted (using redshift:///), the driver will discover this using the AWS SDK
Database: Required (e.g., /dev)
Query Parameters: Configuration options
See Amazon Redshift JDBC Connection URL for connection URL format and Amazon Redshift JDBC Configuration Options for complete parameter reference.
Note
Reserved characters in URI elements must be URI-encoded. For example, @ becomes %40.
Examples:
redshift://admin_user:secret@my-cluster.region.redshift.amazonaws.com:5439/dev
redshift:///dev?cluster_type=redshift-iam&cluster_identifier=my-cluster
redshift:///dev?cluster_type=redshift-serverless&workgroup_name=my-workgroup
redshift://admin:pass@localhost:5439/dev?sslmode=disable
redshift:///dev?cluster_type=redshift-serverless&workgroup_name=my-workgroup&aws_region=us-west-1&aws_access_key_id=AKIA…&aws_secret_access_key=secret
redshift:///dev?cluster_type=redshift-iam&cluster_identifier=my-cluster&auth_provider=BrowserIdcAuthPlugin&idc_region=us-east-1&issuer_url=https://example.com
redshift:///dev?cluster_type=redshift&cluster_identifier=my-cluster&username=newuser&auto_create_user=true
The driver also supports standard PostgreSQL connection strings (e.g., postgresql://user:pass@host:port/dbname) as the uri option. When using this format, all Redshift-specific parameters (e.g., redshift.cluster_type, redshift.workgroup_name) must be passed as separate connection options. However, using the standard redshift:// URI is recommended.
Feature & Type Support¶
| Feature | Support | |
|---|---|---|
| Bulk Ingestion | Create | ✅ |
| Append | ✅ | |
| Create/Append | ✅ | |
| Replace | ✅ | |
| Temporary Table | ✅ | |
| Specify target catalog | ✅ | |
| Specify target schema | ✅ | |
| Non-nullable fields are marked NOT NULL | ✅ | |
| Catalog (GetObjects) | depth=catalogs | ✅ |
| depth=db_schemas | ✅ | |
| depth=tables | ✅ | |
| depth=columns (all) | ✅ | |
| Get Parameter Schema | ✅ | |
| Get Table Schema | ✅ | |
| Prepared Statements | ✅ | |
| Transactions | ✅ | |
Driver-Specific Features¶
| Feature | Name | Support | Description |
|---|---|---|---|
| Authentication | Log in as IAM identity | ✅ | Fetch temporary credentials for the current IAM identity. |
| Log in as IAM identity (serverless) | ✅ | Fetch temporary credentials for the current IAM identity. | |
| Log in as user | ✅ | Fetch credentials for a given user, creating the user if specified. | |
| Log in with OAuth via browser | ✅ | Trigger an OAuth flow to log in. | |
| Log in with no URI (fetch cluster URI from AWS SDK) | ✅ | Log in without specifying cluster URI explicitly. | |
| Log in with token | ✅ | Log in with a token from an identity provider. | |
| Log in with user/password in URI | ✅ | Log in with user/password embedded in the URI. | |
| Log in with user/password in options | ✅ | Log in with user/password specified in options. | |
| Use access key+secret key | ✅ | None | |
| Use explicit profile name | ✅ | None | |
| Configuration | Connect with URI | ✅ | Test authentication with credentials embedded in Redshift URI. |
| Datashare | Get table schema | ✅ | Get the schema of a table in a datashare. |
| Query a table | ✅ | Query a table in a datashare. | |
| Security | SSL Mode | ✅ | Choose whether TLS is required and how the certificate is validated. |
| SSL Mode in URI | ✅ | Verify that the 'sslmode' query parameter provided in the initial URI is extracted and applied to the final resolved connection URI. |
Types¶
Amazon Redshift to Arrow¶
Amazon Redshift Type |
Arrow Type |
|---|---|
BIGINT |
int64 |
BOOLEAN |
bool |
DATE |
date32[day] |
DOUBLE PRECISION |
double |
GEOGRAPHY |
extension<geoarrow.wkb> |
GEOMETRY |
extension<geoarrow.wkb> |
HLLSKETCH |
extension<arrow.opaque[storage_type=string, type_name=HLLSKETCH, vendor_name=Amazon Redshift]> |
INT |
int32 |
INTERVAL DAY TO SECOND |
month_day_nano_interval |
INTERVAL YEAR TO MONTH |
month_day_nano_interval |
NUMERIC |
decimal128 |
REAL |
float |
SMALLINT |
int16 |
SUPER |
extension<arrow.json> |
TIME |
time64[us] |
TIMESTAMP |
timestamp[us] |
TIMESTAMP WITH TIME ZONE |
timestamp[us] (with time zone) |
TIMETZ |
extension<arrow.opaque[storage_type=string, type_name=TIMETZ, vendor_name=Amazon Redshift]> [1] |
VARBINARY |
binary |
VARCHAR |
string |
Arrow to Amazon Redshift¶
| Arrow Type | Amazon Redshift Type | |
|---|---|---|
| Bind | Ingest | |
|
binary |
VARBINARY ⚠️ [2] |
VARBINARY |
|
binary_view |
VARBINARY |
❌ [9] |
|
bool |
BOOLEAN |
|
|
date32[day] |
DATE |
|
|
decimal128 |
NUMERIC |
|
|
double |
DOUBLE PRECISION |
|
|
extension<arrow.json> |
SUPER |
SUPER ⚠️ [13] |
|
extension<geoarrow.wkb> |
(not tested) |
|
|
extension<geoarrow.wkt> |
❌ [11] |
|
|
fixed_size_binary |
VARBINARY |
❌ [10] |
|
float |
REAL ⚠️ [7] |
REAL |
|
halffloat |
REAL |
(not tested) |
|
int16 |
SMALLINT |
|
|
int32 |
INT |
|
|
int64 |
BIGINT |
|
|
large_binary |
VARBINARY |
|
|
large_string |
VARCHAR |
|
|
list |
(not tested) |
SUPER |
|
string |
VARCHAR |
|
|
string_view |
VARCHAR |
❌ [12] |
|
struct |
SUPER |
|
|
time32[ms] |
TIME |
❌ [14] |
|
time32[s] |
TIME |
❌ [14] |
|
time64[ns] |
TIME |
❌ [14] |
|
time64[us] |
TIME |
❌ [14] |
|
timestamp[ms] |
TIMESTAMP |
|
|
timestamp[ms] (with time zone) |
TIMESTAMP(3) WITH TIME ZONE |
|
|
timestamp[ns] |
TIMESTAMP [8] |
TIMESTAMP |
|
timestamp[ns] (with time zone) |
TIMESTAMP(9) WITH TIME ZONE |
|
|
timestamp[s] |
TIMESTAMP |
|
|
timestamp[s] (with time zone) |
TIMESTAMP(0) WITH TIME ZONE |
|
|
timestamp[us] |
TIMESTAMP |
|
|
timestamp[us] (with time zone) |
TIMESTAMP(6) WITH TIME ZONE |
|
Previous Versions¶
To see documentation for previous versions of this driver, see the following: