Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1304211: Pylance throws errors when using copy_options with copy_into_location method #1372

Conversation

Yoshi-Egawa
Copy link
Contributor

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-1304211: Pylance throws errors when using copy_options with copy_into_location method #1363

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

  • src/snowflake/snowpark/dataframe_writer.py: The copy_into_location method was updated in three instances. The copy_options parameter was changed from Optional[str] to Optional[Dict[str, Any]]. This change allows for a wider range of types to be accepted as copy options, providing more flexibility when calling the method. [1] [2] [3]

@Yoshi-Egawa Yoshi-Egawa requested a review from a team as a code owner April 5, 2024 16:08
Copy link

github-actions bot commented Apr 5, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@Yoshi-Egawa
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@Yoshi-Egawa Yoshi-Egawa changed the title Pylance throws errors when using copy_options with copy_into_location method SNOW-1304211: Pylance throws errors when using copy_options with copy_into_location method Apr 5, 2024
Copy link
Collaborator

@sfc-gh-stan sfc-gh-stan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!
The changes LGTM, I suggested 2 additional type hint fixes.

@@ -240,7 +240,7 @@ def copy_into_location(
header: bool = False,
statement_params: Optional[Dict[str, str]] = None,
block: bool = True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
block: bool = True,
block: Literal[True],

@@ -256,7 +256,7 @@ def copy_into_location(
header: bool = False,
statement_params: Optional[Dict[str, str]] = None,
block: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
block: bool = False,
block: Literal[False],

@Yoshi-Egawa
Copy link
Contributor Author

@sfc-gh-stan
Thank you for your suggestion. I have implemented your suggestion with a slight modification.

I have added a default value to the blocks keyword argument. This is because keyword arguments are optional, and not providing a value would result in an error.

@Yoshi-Egawa Yoshi-Egawa requested a review from sfc-gh-stan April 6, 2024 03:17
@sfc-gh-stan sfc-gh-stan added the NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md label Apr 8, 2024
@sfc-gh-stan
Copy link
Collaborator

Tests kicked off by #1377, will merge after merge gates pass.

@sfc-gh-stan sfc-gh-stan merged commit 679bd69 into snowflakedb:main Apr 9, 2024
70 of 121 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2024
@Yoshi-Egawa Yoshi-Egawa deleted the fix/copy_options-type-in-copy_into_location branch May 24, 2024 04:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
NO-CHANGELOG-UPDATES This pull request does not need to update CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SNOW-1304211: Pylance throws errors when using copy_options with copy_into_location method
3 participants