snowflake-connector-python icon indicating copy to clipboard operation
snowflake-connector-python copied to clipboard

SNOW-1763594: Correctly type CursorDict and add TupleDict

Open Polandia94 opened this issue 1 year ago • 2 comments

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: https://github.com/snowflakedb/snowflake-connector-python/issues/1263 but closed after 6 months There was a Pull request with some implemntation, with some comments. https://github.com/snowflakedb/snowflake-connector-python/pull/1264

Polandia94 avatar Oct 25 '24 14:10 Polandia94

Hello @Polandia94 ,

Thanks for raising the issue, will check with team about the current status of the PR and update.

Regards, Sujan

sfc-gh-sghosh avatar Oct 28 '24 05:10 sfc-gh-sghosh

Hello @Polandia94 ,

We will work on the fix, at present there is no ETA when it will be fixed or delivered.

Regards. Sujan

sfc-gh-sghosh avatar Oct 29 '24 05:10 sfc-gh-sghosh