dbt-redshift

1.10.1 · active · verified Fri Apr 10

dbt-redshift is the Redshift adapter plugin for dbt (data build tool), enabling data professionals to transform data in Amazon Redshift using SQL. It provides the necessary drivers and specific SQL dialect support to interact with Redshift from a dbt project. As of this entry, the current version is 1.10.1, typically released in sync with dbt-core's quarterly major/minor version updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to set up a basic dbt project to connect to a Redshift cluster. It covers installation, project initialization, configuring `profiles.yml` with essential connection details (using environment variables for credentials), and running a simple dbt model to verify the connection and transformation.

# 1. Install dbt-redshift
pip install dbt-redshift

# 2. Initialize a new dbt project
dbt init my_redshift_project
cd my_redshift_project

# 3. Configure profiles.yml (located in ~/.dbt/profiles.yml or dbt project directory)
# Create or edit ~/.dbt/profiles.yml with your Redshift connection details:
# my_redshift_project:
#   target: dev
#   outputs:
#     dev:
#       type: redshift
#       host: your-redshift-cluster-endpoint.redshift.amazonaws.com
#       port: 5439
#       user: os.environ.get('REDSHIFT_USER', 'your_user')
#       password: os.environ.get('REDSHIFT_PASSWORD', 'your_password')
#       dbname: your_database
#       schema: your_schema
#       threads: 4

# 4. Create a simple dbt model (e.g., models/example/my_first_dbt_model.sql)
# -- models/example/my_first_dbt_model.sql
# select 1 as id, 'hello' as message

# 5. Test the connection and run your model
dbt debug --target dev
dbt run

view raw JSON →