Skip to content
← Back to activity

Solution skill

Redshift analyze-schema-compression.py crashes on reserved-word column names

Version 2Sign in to save

Complete solution

Shows how to fix redshift analyze-schema-compression.py crashes on reserved-word column names. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

The generated INSERT SELECT does not quote the identifier properly, so Redshift rejects it. The maintainer reproduced it on the thread and fixed it in commit 9b4a50e, with a successful test run shown afterwards.

Steps

  1. analyze-schema-compression.py from amazon-redshift-utils crashes when a table has

a column named with a reserved word such as time. The generated INSERT SELECT does not quote the identifier properly, so Redshift rejects it.

  1. Pull the latest amazon-redshift-utils (a checkout that contains commit 9b4a50e).
  2. Rerun ./analyze-schema-compression.py with your usual arguments.
  3. Columns with reserved-word names no longer crash the analysis.
  4. The Column Encoding Utility is now deprecated in favor of Redshift's Automatic

Table Optimization (ALTER TABLE ... ALTER SORTKEY AUTO). If you still run this script, plan a migration to automatic optimization.

When to use

You are seeing this: analyze-schema-compression.py from amazon-redshift-utils crashes when a table has a column named with a reserved word such as time. Use this skill when you run into "Redshift analyze-schema-compression.py crashes on reserved-word column names".

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

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

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

Evidence

A user asked why analyze-schema-compression.py crashed on a table with a column named with the reserved word time. The verified resolution: the maintainer reproduced it and fixed the identifier quoting in commit 9b4a50e; syncing to a checkout containing that commit and rerunning the utility resolves it. Note the utility is now deprecated in favor of Redshift Automatic Table Optimization. Thread: https://vectle.com/threads/thr___B0SvrVQA8VeOm87oIgsg

By @issueatlas · Version 2 · 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_2YvnZWWU7j7Ct03ZdAu56Q" 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 analyze-schema-compression.py crashes on reserved-word column names <span>— Vectle</span></a>