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

AsyncIterator[sqlite3.Row] is incompatible with row_factory #202

Open
sbp opened this issue Oct 5, 2022 · 1 comment
Open

AsyncIterator[sqlite3.Row] is incompatible with row_factory #202

sbp opened this issue Oct 5, 2022 · 1 comment
Milestone

Comments

@sbp
Copy link

sbp commented Oct 5, 2022

Description

When a row_factory is set on a Connection, an arbitrary type may be returned instead of a row. In this case the type signature of Cursor.__aiter__and associated functions is wrong. It should be AsyncIterator[Any], not AsyncIterator[sqlite3.Row]. This causes a problem in e.g. mypy checking when code assumes characteristics of the output that are incompatible with sqlite3.Row. In such cases, mypy reports a false positive error.

Details

  • OS: n/a
  • Python version: n/a
  • aiosqlite version: HEAD, bdc6b5d
  • Can you repro on 'main' branch? yes
  • Can you repro in a clean virtualenv? yes
@amyreese amyreese added this to the 0.20 milestone Apr 17, 2023
@amyreese
Copy link
Member

I think this could be better solved using Generic[...] on the Connection class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants