apache / apache/arrow-adbc

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

Open
#3,584 2 comments 0 reactions 0 assignees View on GitHub
Type: bug
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

### 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*()](https://peps.python.org/pep-0249/#id19) method yet.

### Stack Trace
```
Traceback (most recent call last):
File "foo.py", line 259, in
assert cur.description is None, cur.description
^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: []
```
### How can we reproduce the bug?
```py
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.