Skip to content

ProgrammingError while running SQL DDL/DML Statements #201

@avneeshn

Description

@avneeshn

Driver version

2.0.913

Redshift version

PostgreSQL 8.0.2 on i686-pc-linux-gnu

Client Operating System

Linux

Python version

3.8

Table schema

Problem description

  1. Expected behaviour: Redshift python driver should not throw any error for cursor.fetchall() while executing SQL DML statements.
  2. Actual behaviour: Redshift python driver throws ProgrammingError for cursor.fetchall() while executing SQL DML statements.
    For eg:
    Run:
res_cursor.execute("create table sample_table_from_sm (col1 int);")
data = res_cursor.fetchall()

Output:

ERROR:c8e60ff5311f4a709f6ea83e092d3d4c:Error while executing query no result set
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/redshift_connector/cursor.py", line 498, in __next__
    return self._cached_rows.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/**********_sql_execution/redshift/connection.py", line 61, in execute
    data = res_cursor.fetchall()
  File "/opt/conda/lib/python3.8/site-packages/redshift_connector/cursor.py", line 456, in fetchall
    return tuple(self)
  File "/opt/conda/lib/python3.8/site-packages/redshift_connector/cursor.py", line 503, in __next__
    raise ProgrammingError("no result set")
redshift_connector.error.ProgrammingError: no result set
ERROR:root:Error executing SQL query: 
create table sample_table_from_sm (col1 int);

no result set

P.S. the same issue occurs for an UPDATE query.

  1. Error message/stack trace: Attached above
  2. Any other details that can be helpful:

Python Driver trace logs

Reproduction code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions