How to Connect Redshift to DataGrip in PostgreSQL

Galaxy Glossary

How do I connect Amazon Redshift to DataGrip?

Create a JDBC data source in JetBrains DataGrip that points to your Amazon Redshift cluster so you can run SQL locally.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Description

Table of Contents

Why connect Amazon Redshift to JetBrains DataGrip?

DataGrip offers a full IDE experience—version control, code completion, and profiling—while Redshift provides scalable analytics. Connecting the two lets you develop, test, and optimize warehouse queries from your desktop.

What prerequisites must be in place?

You need: ① Redshift endpoint (host & port 5439), database name, user, and password. ② An inbound security-group rule allowing your IP. ③ DataGrip 2022.3+ with the bundled Amazon Redshift JDBC driver (or download v2.1+).

How do I add a Redshift data source in DataGrip?

Open Database Explorer → + → Data Source → Amazon Redshift. In the "General" tab, enter host, port, database, user, and password. Tick “Use SSL” if required. Click Test Connection; once successful, press OK.

Where do I place advanced parameters?

Switch to the "Advanced" tab. Add key-value pairs like ssl=true or tcpKeepAlive=true. For session-level settings, use the Driver Properties sub-panel.

How can I verify the connection?

Run a simple query such as SELECT current_user, current_database();. If results appear, the configuration is correct.

How do I run ecommerce queries after connecting?

Create a SQL file and execute:
SELECT c.name, SUM(oi.quantity * p.price) AS lifetime_value FROM Customers c JOIN Orders o ON o.customer_id = c.id JOIN OrderItems oi ON oi.order_id = o.id JOIN Products p ON p.id = oi.product_id GROUP BY c.name ORDER BY lifetime_value DESC; DataGrip shows a results grid you can export to CSV.

What best practices should I follow?

Store credentials in DataGrip’s password vault, enable SSH tunnel if VPN access is unavailable, and limit result-set size under Settings → Database → Data Views to avoid accidental large downloads.

Why How to Connect Redshift to DataGrip in PostgreSQL is important

How to Connect Redshift to DataGrip in PostgreSQL Example Usage


-- Find top-selling products this quarter
SELECT p.name, SUM(oi.quantity) AS units_sold, SUM(oi.quantity * p.price) AS revenue
FROM Orders o
JOIN OrderItems oi ON oi.order_id = o.id
JOIN Products p    ON p.id = oi.product_id
WHERE o.order_date BETWEEN date_trunc('quarter', current_date)
                      AND current_date
GROUP BY p.name
ORDER BY revenue DESC
LIMIT 10;

How to Connect Redshift to DataGrip in PostgreSQL Syntax


JDBC URL template:
jdbc:redshift://<HOST>:<PORT>/<DBNAME>?ssl=<true|false>&tcpKeepAlive=true

Required parameters:
  host         – Redshift cluster endpoint (example: example.abc123.us-east-1.redshift.amazonaws.com)
  port         – 5439 (default)
  dbname       – Target database (e.g., analytics)
  user         – IAM or database user (e.g., analyst_ro)
  password     – User password or temporary token

Optional parameters:
  ssl          – Force SSL (true/false)
  tcpKeepAlive – Keep TCP alive (true/false)
  loglevel     – DEBUG | INFO | WARN | ERROR

Example (ecommerce):
jdbc:redshift://shop-prod.cle1ab2xyz.us-east-1.redshift.amazonaws.com:5439/shopdb?ssl=true&tcpKeepAlive=true

Common Mistakes

Frequently Asked Questions (FAQs)

Does DataGrip support Redshift Spectrum external tables?

Yes. Once connected, external schemas in svv_external_schemas appear. You can query them like normal tables.

Can I use temporary credentials from AWS IAM?

Yes. Generate a temporary auth token with AWS CLI and paste it as the password. Set ssl=true in the JDBC string.

Why does SSL handshake fail?

Redshift clusters created after 2021 require TLS 1.2. Ensure your JDBC driver is v2.1+ and that ssl=true is set.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.