Amazon Redshift v1.0.0¶
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", # for Redshift Serverless with bastion host
#"uri": "postgresql://localhost:5440", # for Redshift Provisioned with bastion host
#"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.
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 | ✅ | |
Types¶
SELECT (SQL to Arrow) type mapping¶
SQL Type |
Arrow Type |
|---|---|
BIGINT |
int64 |
BOOLEAN |
bool |
DATE |
date32[day] |
DOUBLE PRECISION |
double |
INT |
int32 |
INTERVAL DAY TO SECOND |
month_day_nano_interval |
INTERVAL YEAR TO MONTH |
month_day_nano_interval |
NUMERIC |
decimal128 |
REAL |
float |
SMALLINT |
int16 |
TIME |
time64[us] |
TIMESTAMP |
timestamp[us] |
TIMESTAMP WITH TIME ZONE |
timestamp[us, tz=UTC] |
VARBINARY |
binary |
VARCHAR |
string |
Bind parameter (Arrow to SQL) type mapping¶
Arrow Type |
SQL Type |
|---|---|
binary |
VARBINARY ⚠️ [2] |
bool |
BOOLEAN |
date32[day] |
DATE |
decimal128 |
NUMERIC |
double |
DOUBLE PRECISION |
float |
REAL ⚠️ [1] |
int16 |
SMALLINT |
int32 |
INT |
int64 |
BIGINT |
string |
VARCHAR |
time64[us] |
TIME |
timestamp[us, tz=UTC] |
TIMESTAMP WITH TIME ZONE |
timestamp[us] |
TIMESTAMP |
Bulk ingest (Arrow to SQL) type mapping¶
Arrow Type |
SQL Type |
|---|---|
binary |
VARBINARY |
bool |
BOOLEAN |
date32[day] |
DATE |
decimal128 |
NUMERIC |
double |
DOUBLE PRECISION |
float |
REAL |
int16 |
SMALLINT |
int32 |
INT |
int64 |
BIGINT |
string |
VARCHAR |
time64[us] |
❌ [3] |
timestamp[us, tz=UTC] |
TIMESTAMP WITH TIME ZONE |
timestamp[us] |
TIMESTAMP |