snowflakedb / snowflakedb/snowpark-python
SNOW-922952: mypy possible overload variant
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 341
- Forks
- 155
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 27
Description
Please answer these questions before submitting your issue. Thanks!
-
What version of Python are you using?
Python 3.9.18
-
What operating system and processor architecture are you using?
macOS-12.5.1-x86_64-i386-64bit
-
What are the component versions in the environment (
pip freeze)?
mypy==1.5.1
mypy-extensions==1.0.0
snowflake-connector-python==3.3.0b1
snowflake-snowpark-python==1.8.0
-
What did you do?
Code:
from snowflake.snowpark import DataFrame
def store_table(df: DataFrame, destination: str):
df.write.saveAsTable(destination)
Running mypy store_table.pyon the command line gives the following output
store_table.py: note: In function "store_table":
store_table.py:5:5: error: No overload variant matches argument type "str" [call-overload]
df.write.saveAsTable(destination)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
store_table.py:5:5: note: Possible overload variants:
store_table.py:5:5: note: def (table_name: Union[str, Iterable[str]], *, mode: Optional[str] = ..., column_order: str = ..., create_temp_table: bool = ..., table_type: Literal['', 'temp', 'temporary', 'transient'] = ..., clustering_keys: Iterable[Column], statement_params: Optional[dict[str, str]] = ..., block: bool = ...) -> None
store_table.py:5:5: note: def (table_name: Union[str, Iterable[str]], *, mode: Optional[str] = ..., column_order: str = ..., create_temp_table: bool = ..., table_type: Literal['', 'temp', 'temporary', 'transient'] = ..., clustering_keys: Iterable[Column], statement_params: Optional[dict[str, str]] = ..., block: bool = ...) -> AsyncJob
Found 1 error in 1 file (checked 1 source file)
- What did you expect to see?
Success: no issues found
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the store_table.py example and run mypy against the DataFrame.saveAsTable call to reproduce the overload error. Trace the saveAsTable type definition and adjust the typing so a string table name passes mypy, then confirm the example reports “Success: no issues found.”
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, data-engineering
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100