Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
Installing the extension
DuckDB is an analytical database that runs locally. You work with it from the DuckDB command line (CLI), the Python package, or another client, and you add capabilities to it by installing extensions. The Redshift extension for DuckDB is one of these extensions. It requires DuckDB v2.0.1.
If you're new to DuckDB, these are the concepts this topic uses:
-
Extension – An add-on that gives DuckDB new capabilities. This feature uses two:
redshift(the Redshift extension) andaws(a built-in DuckDB extension that supplies your AWS credentials). -
Repository – The location DuckDB downloads an extension from. The
redshiftextension comes from the AWS DuckDB extension repository, which you register one time. -
Install – Downloads an extension to your machine. You install the extension once for each DuckDB version.
-
Load – Makes an installed extension available in the current session. Run
LOAD redshift FROM aws.amazon.com;in each session before you attach a Redshift target, unless theawsextension is already loaded in the session, for example because you created anawssecret. -
Secret – Where DuckDB stores the AWS credentials the extension signs in with. You create one with
CREATE SECRET (TYPE aws, ...), which loads theawsextension automatically.
This topic covers installation, loading, compatibility, updates, and the platform requirements.
Installing and loading the extension
The following SQL example registers the AWS DuckDB extension repository by its host name and installs the extension. When you register the repository, DuckDB fetches the signing keys it publishes over HTTPS and checks every extension it installs from the repository against them:
CREATE EXTENSION REPOSITORY aws.amazon.com; INSTALL redshift FROM aws.amazon.com;
Registering the repository is one-time setup for each user on a machine. To see the
fingerprints of the signing keys DuckDB pinned, query
duckdb_extension_repositories():
SELECT repository_name, key_fingerprints FROM duckdb_extension_repositories();
Load the extension in each session before you attach a target:
LOAD redshift FROM aws.amazon.com;
An attach of a Redshift Serverless workgroup's long-form ARN, without TYPE redshift,
needs no LOAD, because the aws extension loads
redshift for it. Any other attach also loads redshift when
the aws extension is already loaded, for example because you created an
aws secret earlier in the session. Otherwise, run the LOAD
first. The following example attaches a workgroup by its long-form ARN:
ATTACH 'arn:aws:redshift-serverless:us-east-1:111122223333:workgroup/my-label/my-workgroup' AS rs (CREDENTIAL_PROVIDER aws_default_chain);
To check what is installed and loaded, query
duckdb_extensions():
SELECT extension_name, installed, loaded FROM duckdb_extensions() WHERE extension_name IN ('aws', 'redshift') ORDER BY 1;
If redshift isn't loaded, run LOAD redshift FROM aws.amazon.com; again.
Compatibility and updates
Keep the extension compatible with your DuckDB version with the following practices:
-
One DuckDB version per binary. AWS builds each extension binary for one DuckDB version, today v2.0.1, and DuckDB does not load a binary built for another version.
INSTALL redshift FROM aws.amazon.com;downloads the binary built for the DuckDB version that runs it. -
Install again after a DuckDB upgrade. After you upgrade DuckDB, install the extension again from the new version. On an offline host, do that before you take it offline.
To take a new release, run UPDATE EXTENSIONS and then restart
DuckDB, because a loaded extension and the driver it loaded stay
loaded until the process ends. UPDATE EXTENSIONS updates every installed
extension, including this one from the repository it was installed from:
UPDATE EXTENSIONS;
Giving a list limits the update to extensions that were not installed from a named
repository, so UPDATE EXTENSIONS (redshift) fails with an error that the extension is not installed. To
take a new release of this extension alone, force install it again, then restart
DuckDB:
FORCE INSTALL redshift FROM aws.amazon.com;
The extension_version column in duckdb_extensions() shows
the release version, v. Releases follow
semantic versioning, and the AWS DuckDB extension repository serves
each release under its version. To see which release is loaded, query it:X.Y.Z
SELECT extension_version FROM duckdb_extensions() WHERE extension_name = 'redshift';
The CHANGELOG.md file in the aws/duckdb-redshift
repository on GitHub
A newer release fixes a release that has a defect, and you install it the same way. There's no supported way to go back to an earlier release.
Don't enable allow_unsigned_extensions to load the published
extension. Install the signed builds from the repository.
Platform requirements
AWS builds each release for DuckDB v2.0.1 and qualifies it on the following platforms before publishing it.
| Platform | Hosts | Prerequisites |
|---|---|---|
|
Linux on x86-64 |
glibc 2.34 or later, a |
|
Linux on Arm64 |
The same as |
|
macOS on Apple silicon |
macOS 11.7 or later |
|
macOS on Intel |
macOS 11.7 or later |
|
Windows Server 2022 on x64 |
Microsoft Visual C++ v14 x64 redistributable, version 14.44 or later (see Windows) |
Linux with musl (such as Alpine), windows_amd64_mingw,
windows_arm64, and DuckDB-WASM aren't supported.
Linux
Use glibc 2.34 or later and a libstdc++ that provides
GLIBCXX_3.4.30 (from GCC 12 or later). Ubuntu 22.04 and later and Amazon
Linux 2023 from release 2023.7.20250331 meet these; Red Hat Enterprise Linux 8 and 9
don't. Also install libkeyutils.so.1, which minimal Ubuntu and Debian
images lack. Without it, the first connection fails with a message that the driver
needs libkeyutils.so.1. After you install the package, restart
DuckDB.
Run one of the following commands to install the package:
# Debian, Ubuntu sudo apt-get install -y libkeyutils1 # Amazon Linux, RHEL, Fedora sudo dnf install -y keyutils-libs
Make sure a certificate authority (CA) bundle is installed. For more information, see Security considerations and limitations.
macOS
Use macOS 11.7 or later. The extension reads trusted CA certificates from
SSL_CERT_FILE or /etc/ssl/cert.pem, and it doesn't read the
Keychain. A hardened host application needs the
com.apple.security.cs.disable-library-validation entitlement to load the
driver; the DuckDB CLI doesn't need it. The osx_amd64
build is qualified on Apple silicon under Rosetta 2.
Windows
Use Windows Server 2022 on x64. Windows 10 and 11 aren't supported yet. Install the latest Visual C++ v14 x64 redistributable from Microsoft, version 14.44 or later. Without it, the first connection fails with a message that names the missing runtime file. A program that bundles its own copy of the runtime keeps using that copy, whatever the redistributable installs.
The host's Windows certificate store must hold the Amazon root certificate that the Redshift endpoints chain to. Supported Windows Server images have it; a host that is offline or has automatic root update turned off fails to connect until the root is added.
The extension file and the driver files it writes aren't Authenticode-signed. On a
host that enforces App Control for Business, allow them by hash, or by path for a
REDSHIFT_DRIVER_DIR that an administrator owns and no other account can
write. Smart App Control in
enforcement mode isn't supported yet. Kerberos and GSS authentication aren't
supported on any platform; on Windows, a Kerberos environment variable set in the
process stops the extension from loading the driver.
Requirements
The extension has the following requirements:
-
DuckDB v2.0.1. Each extension binary is built for one DuckDB version.
-
The DuckDB
awsextension, only when you name aSECRETor attach a long-form ARN withoutTYPE redshift. DuckDB installs and loads it automatically when you create anawssecret. -
No separate driver. The extension includes the Amazon Redshift ODBC driver.
Building the extension from source
To build the extension yourself, you need git, make, curl, CMake 3.19 or later
(3.21 or later to build windows_amd64), a C++17 compiler, and Python
3.
Clone the repository, build DuckDB, then build the extension with the embedded driver:
git clone https://github.com/aws/duckdb-redshift.git cd duckdb-redshift make duckdb make release REDSHIFT_CLIENT=odbc
The build writes the extension to
build/release/extension/redshift/redshift.duckdb_extension,
and a DuckDB shell with the extension built in to
build/release/duckdb. The build downloads the Amazon Redshift ODBC driver
release that the repository pins and checks it before embedding it.
A build you make yourself isn't signed. Try it in the shell the build writes,
build/release/duckdb, which has the extension built in. Use the signed
releases elsewhere.