Skip to content

feat: Add types for snowflake.connector.connect#2271

Open
max-muoto wants to merge 6 commits intosnowflakedb:mainfrom
max-muoto:add-types-for-snowflake-connect
Open

feat: Add types for snowflake.connector.connect#2271
max-muoto wants to merge 6 commits intosnowflakedb:mainfrom
max-muoto:add-types-for-snowflake-connect

Conversation

@max-muoto
Copy link

@max-muoto max-muoto commented Apr 16, 2025

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-2043406: Type Annotations for snowflake.connector.connect #2270

  2. Fill out the following pre-review checklist:

None are relevant, only adding type annotations)

  • 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 modifying authorization mechanisms
  • I am adding new credentials
  • I am modifying OCSP code
  • I am adding a new dependency
  1. Please describe how your code solves the related issue.

    The PR adds missing type annotations, so that snowflake.connector.connect and the Implementation class properly match with both having full annotations using a TypedDict to avoid repeated types.

  2. (Optional) PR for stored-proc connector:

@github-actions
Copy link

github-actions bot commented Apr 16, 2025

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

@max-muoto
Copy link
Author

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

cap: int = DEFAULT_BACKOFF_CAP,
enable_jitter: bool = DEFAULT_ENABLE_JITTER,
) -> Callable[..., Iterator[int]]:
) -> Callable[[], Generator[int]]:
Copy link
Author

@max-muoto max-muoto Apr 16, 2025

Choose a reason for hiding this comment

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

Adding more accurate types in this module to make sure these functions will properly fulfill the annotation for backoff_policy

@max-muoto max-muoto marked this pull request as ready for review April 16, 2025 03:55
Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski left a comment

Choose a reason for hiding this comment

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

Thank You for the PR, I left one comment.

binding: str | None


class SnowflakeConnectionConfig(TypedDict):
Copy link
Contributor

Choose a reason for hiding this comment

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

Did You have a look at the DEFAULT_CONFIGURATION dictionary? It already contains list of supported config parameters. Maybe both could be merged into one entity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SNOW-2043406: Type Annotations for snowflake.connector.connect

3 participants