Skip to content

dbapi Cursor.description should be none for statement that don't return rows #3584

@CaselIT

Description

@CaselIT

What happened?

The python dbapi spect specifies that descriptor should be none if a statement does not return any data: https://peps.python.org/pep-0249/#description

This attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked via the .execute*() method yet.

Stack Trace

Traceback (most recent call last):
  File "foo.py", line 259, in <module>
    assert cur.description is None, cur.description
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: []

How can we reproduce the bug?

from adbc_driver_postgresql.dbapi import connect
url = 'postgresql://scott:tiger@localhost/test' 
with connect(url) as conn, conn.cursor() as cur:
    cur.execute('create table t(a int)')
    assert cur.description is None, cur.description

Environment/Setup

adbc_driver_manager = 1.8.0
adbc_driver_postgresql = 1.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions