1

I am trying to query a datashare from AWS Data Exchange using Redshift in Python. This datashare, to be precise.

This is how I am attempting to run my Python code:

import os
import psycopg


os.environ["PGCLIENTENCODING"] = "utf-8"

connection = psycopg.connect(
    ...
)

query = "SELECT * FROM store s LIMIT 10;"
with connection.cursor() as cur:
    cur.execute(query)
    result = cur.fetchall()

I also tried it using the official Redshift connector:

import redshift_connector


connection = redshift_connector.connect(
    ...
)

cursor = connection.cursor()

query = "SELECT * FROM store s LIMIT 10;"
cursor.execute(query)
result = cursor.fetchall()

What is going on here? The error message implies that I am attempting to run a write operation against the database, but as shown above, it's clearly a very simple SELECT statement.

0