Skip to content

SNOW-1763594: Correctly type CursorDict and add TupleDictΒ #2085

@Polandia94

Description

@Polandia94

What is the current behavior?

cursor.fetchone(), cursor.fetchmany() and cursor.fetchall() return a union type between tuple and dict. That require a lot of casting to work with type checkers.

What is the desired behavior?

Return a dict(or list of dicts) if cursor is DictCursor, a tuple(or list of tuples) if cursor is a TupleCursor, and keep the current implementation to SnowflakeCursor.

How would this improve snowflake-connector-python?

It will improve the type hints

References and other background

This issue was mentioned on:
#1263
but closed after 6 months
There was a Pull request with some implemntation, with some comments.
#1264

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurestatus-triage_doneInitial triage done, will be further handled by the driver team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions