You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accessing functions on a snowpark dataframe results in errors due to mishandling of types in the snowpark library.
Example:
Using type checkers (Pylance/Pyright in VS Code)
Results in error:
Argument of type "None" cannot be assigned to parameter "_ast_stmt" of type "Assign" in function "filter"
"None" is not assignable to "Assign"Pylance[reportArgumentType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportArgumentType)
Example code:
from snowflake import snowpark
from snowflake.snowpark.functions import col
def example(session: snowpark.Session):
session.table("example_table").where(col("col1") == "value1")
What did you expect to see?
This should not result in a type error.
More information:
This seems to be introduced in snowflake-snowpark-python versions > 1.25.0 due to assigning None to arguments which are not marked as optional.
github-actionsbot
changed the title
Type Errors on DataFrame Functions Due to Missing Optional Type Hints
SNOW-1952961: Type Errors on DataFrame Functions Due to Missing Optional Type Hints
Feb 27, 2025
I also just ran into the same issue, on e.g. session.sql() and DataFrame.with_column() calls.
A temporary workaround seems to be that pyright <= 1.1.394 is able to work with this Optional[...] missing, but the latest version rightfully throws errors.
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using?
Python 3.11.7
What operating system and processor architecture are you using?
macOS-15.3.1-arm64-arm-64bit
pip freeze
)?snowflake-connector-python==3.13.2
snowflake-snowpark-python==1.28.0
Accessing functions on a snowpark dataframe results in errors due to mishandling of types in the snowpark library.
Example:
Using type checkers (Pylance/Pyright in VS Code)
Results in error:
Example code:
This should not result in a type error.
More information:
This seems to be introduced in
snowflake-snowpark-python
versions > 1.25.0 due to assigningNone
to arguments which are not marked as optional.Example line
The text was updated successfully, but these errors were encountered: