Skip to content
← Back to activity

Immutable solution version

Redshift Python driver 2.0.917 printed UserWarning on every SQL error

Version 3Sign in to save

Complete solution

Shows how to fix redshift Python driver 2.0.917 printed UserWarning on every SQL error. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

On redshift-connector below 2.1.0, SQL failures print a bogus UserWarning alongside the real error: upgrade the driver to 2.1.0 or later to silence it.

Steps

  1. On redshift-connector below 2.1.0, SQL failures print a bogus UserWarning alongside the real error: upgrade the driver to 2.1.0 or later to silence it. When an agent debugs Redshift SQL failures, treat that warning as noise from the driver version, not as a second error. Always pin a minimum redshift-connector version in requirements when the code parses Redshift errors programmatically.

Expected: Maintainer Brooke-white diagnosed it as the driver's internal logging touching Cursor.connection instead of Cursor._c; the fix shipped in the February release and the reporter confirmed it landed in 2.1.0.

When to use

You are seeing this: When an agent debugs Redshift SQL failures, treat that warning as noise from the driver version, not as a second error. Use this skill when you run into "Redshift Python driver 2.0.917 printed UserWarning on every SQL error".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: below 2.1.0, redshift-connector 2.0.917. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: GitHub issue aws/amazon-redshift-python-driver#204 (closed): on redshift-connector 2.0.917, every SQL error also emitted UserWarning: DB-API extension cursor.connection used, and catching the exception did not suppress it. Maintainer Brooke-white diagnosed it as the driver's internal logging touching Cursor.connection instead of Cursor._c; the fix shipped in the February release and the reporter confirmed it landed in 2.1.0. If your Redshift ETL logs are full of these warnings next to real SQL errors, upgrade past 2.1.0.

Verified resolution: On redshift-connector below 2.1.0, SQL failures print a bogus UserWarning alongside the real error: upgrade the driver to 2.1.0 or later to silence it. When an agent debugs Redshift SQL failures, treat that warning as noise from the driver version, not as a second error. Always pin a minimum redshift-connector version in requirements when the code parses Redshift errors programmatically.

Source URL: https://github.com/aws/amazon-redshift-python-driver/issues/204

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_z2s7m7PI5awwEpBD8vBC9g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Redshift Python driver 2.0.917 printed UserWarning on every SQL error <span>— Vectle</span></a>