Solve: Redshift Reporter: A CLI-Based Redshift Explorer for Engineers Who Need Answers


Redshift Reporter: A CLI-Based Redshift Explorer for Engineers Who Need Answers







The Redshift Console is powerful. SQL IDEs are flexible. But sometimes, engineers need something simpler—a terminal-native interface that just shows you what’s in the warehouse without ceremony or risk.

That’s what Redshift Reporter is.

This menu-driven Python tool gives you a read-only interface to your Amazon Redshift cluster. From any terminal—on your laptop, EC2 instance, Cloud9, or local dev box—you can inspect schemas, run queries, and sample tables without ever modifying data. Everything you do is logged.


Installation (Linux with Python 3)

You can install Redshift Reporter in two ways: using pip, or system-wide via apt.

Option 1: Pip install with requirements.txt

Bash
wget https://gist.github.com/roseaar42/6bd7836c9f7522799d4cdaa450f523b8#file-redshift_reporter-py

Bash
wget https://gist.github.com/roseaar42/6bd7836c9f7522799d4cdaa450f523b8#file-requirements-txt

Bash
pip install -r requirements.txt 

Option 2: Linux apt install (no venv required)

Bash
sudo apt update   

Bash
sudo apt install python3-psycopg2


Run the Script

Then run: 

Bash
python3 redshift_reporter.py


Main Menu

Here’s what you see when you launch the tool:

Bash
==============================
  Redshift Reporter CLI
==============================
Select an option:
1. List Schemas
2. List Tables in a Schema
3. Describe a Table
4. Run a Read-Only SQL Query
5. Show Table Sample (LIMIT 10)
6. View Session Log
7. Exit 

This menu is what makes the tool special. It’s like aws configure meets psql, but without the risk of a fat-fingered mutation or a clunky interface.


Sample Report (Abbreviated)

Once connected, you might generate a report like this: 

Bash
Schemas:
- public
- analytics

Tables in schema 'public':
- users
- orders
- products

Description of table 'public.orders':
- order_id (integer)
- user_id (integer)
- product_id (integer)
- created_at (timestamp)

Sample from 'public.orders':
(1, 101, 501, '2024-11-02 14:33:12')
(2, 102, 502, '2024-11-02 14:34:01')  

This gives engineers a quick, structured overview of what’s in a cluster—perfect for investigation, auditing, or just getting oriented.


Session Logs

All actions are logged automatically. Session logs are written to: 

Bash
~/.redshift_reporter/session_YYYYMMDD_HHMMSS.log 

Here’s a snippet: 

Bash
[2025-05-14T15:02:01] Connected to Redshift
[2025-05-14T15:02:13] Listed schemas
[2025-05-14T15:02:32] Described table: public.orders
[2025-05-14T15:03:10] Ran query: SELECT COUNT(*) FROM public.orders;  

Whether you're handing off findings to a teammate or retracing your own steps later, everything is preserved.


Read-Only by Design

Redshift Reporter is built to be safe:
  • It only permits SELECT queries
  • It logs all commands with timestamps
  • It never modifies your Redshift data
This makes it ideal for production environments where visibility matters, but mutability is dangerous.


Use Cases

Redshift Reporter is useful when you want to:
  • Quickly review cluster contents in a dev or staging account
  • Provide a junior engineer a safe way to explore a Redshift setup
  • Run lightweight audits or discovery tasks during troubleshooting
  • Avoid dashboard overhead when you just want answers


Script + README on Github Gist

View the source on GitHub Gist

No login sessions. No cloud GUI. Just answers—from your terminal.


Need AWS Expertise?

We'd love to help you with your AWS projects.  Feel free to reach out to us at info@pacificw.com.


Written by Aaron Rose, software engineer and technology writer at Tech-Reader.blog.

Comments

Popular posts from this blog

The New ChatGPT Reason Feature: What It Is and Why You Should Use It

Raspberry Pi Connect vs. RealVNC: A Comprehensive Comparison

The Reasoning Chain in DeepSeek R1: A Glimpse into AI’s Thought Process