snowflakedb / snowflakedb/snowpark-python

SNOW-922952: mypy possible overload variant

Open
#1,058 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs triage
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!

  1. What version of Python are you using?

    Python 3.9.18

  2. What operating system and processor architecture are you using?

    macOS-12.5.1-x86_64-i386-64bit

  3. 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

  1. 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)
 
  1. What did you expect to see?

Success: no issues found

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.