Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetchall doesn't respect the cursor position #414

Closed
1 task done
boiledfroginthewell opened this issue Sep 30, 2023 · 0 comments · Fixed by #415
Closed
1 task done

fetchall doesn't respect the cursor position #414

boiledfroginthewell opened this issue Sep 30, 2023 · 0 comments · Fixed by #415

Comments

@boiledfroginthewell
Copy link

Expected behavior

After some rows are fetched, fetchall() should return remaining rows as PEP-0249 says:

https://peps.python.org/pep-0249/#fetchall
Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor’s arraysize attribute can affect the performance of this operation.

Actual behavior

fetchall() returns all the rows.

Steps To Reproduce

cur = conn.cursor()
cur.execute("SELECT * FROM ( VALUES (1), (2), (3), (4), (5), (6))")
print(cur.fetchmany(2))
print(cur.fetchall()) # should return 4 rows
print(cur.fetchmany(10)) # should return no rows

Actual Outputs:

[[1], [2]]
[[1], [2], [3], [4], [5], [6]]
[[3], [4], [5], [6]]

Expected Outputs:

[[1], [2]]
[[3], [4], [5], [6]]
[]

Log output

No response

Operating System

Manjaro Linux

Trino Python client version

0.327.0

Trino Server version

427

Python version

3.11.5

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant