snowflakedb / snowflake-connector-python

Snowflake Connector for Python
https://pypi.python.org/pypi/snowflake-connector-python/
Apache License 2.0
568 stars 456 forks source link

SNOW-1511473: "type[type]" is incompatible with "type[SnowflakeCursor]" #1984

Open tekumara opened 1 week ago

tekumara commented 1 week ago

Python version

3.9

Operating system and processor architecture

macos

Installed packages

snowflake-connector-python==3.11.0

What did you do?

*_, dcur = conn.execute_string("select 1",cursor_class=snowflake.connector.cursor.DictCursor)
dcur.fetchall()

What did you expect to see?

No type error, but get this in pyright/pylance/vscode:

CleanShot 2024-06-28 at 22 11 56@2x

Can you set logging to DEBUG and collect the logs?

No response

sfc-gh-sghosh commented 1 week ago

Hello @tekumara ,

Thanks for raising the issue, we are looking into it, will update.

Regards, Sujan

sfc-gh-sghosh commented 6 days ago

Hello @tekumara ,

Could you try the code in this way, I just tried and I am not getting any compilation error in VScode

`cursor1 = con.cursor(snowflake.connector.cursor.DictCursor)

try:
    r1 = cursor1.execute("select 1").fetchall()
finally:
    cursor1.close()`
tekumara commented 6 days ago

That's works but I'm not using execute I'm using execute_string in my codebase to execute multiple sql statements (I simplified it for the MRE above)