Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Updates SnowflakeCredentials to implement the CredentialsBlock abstract block type #51

Merged
merged 7 commits into from
Dec 27, 2022

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Dec 27, 2022

Adds a get_client method to SnowflakeCredentials and refactors interaction with SnowflakeConnector so that SnowflakeCredentials now owns creation of SnowflakeConnection instances.

Example

Get Snowflake connection with only block configuration:

from prefect_snowflake import SnowflakeCredentials
snowflake_credentials_block = SnowflakeCredentials.load("BLOCK_NAME")
connection = snowflake_credentials_block.get_client()

Get Snowflake connector scoped to a specified database:

from prefect_snowflake import SnowflakeCredentials
snowflake_credentials_block = SnowflakeCredentials.load("BLOCK_NAME")
connection = snowflake_credentials_block.get_client(database="my_database")

Screenshots

Docs for new get_client method.
Screenshot 2022-12-27 at 11 45 57 AM

Checklist

  • References any related issue by including "Closes #" or "Closes ".
    • If no issue exists and your change is not a small fix, please create an issue first.
  • Includes tests or only affects documentation.
  • Passes pre-commit checks.
    • Run pre-commit install && pre-commit run --all locally for formatting and linting.
  • Includes screenshots of documentation updates.
    • Run mkdocs serve view documentation locally.
  • Summarizes PR's changes in CHANGELOG.md

@desertaxle desertaxle marked this pull request as ready for review December 27, 2022 17:48
@desertaxle desertaxle requested a review from a team December 27, 2022 17:49
Copy link
Contributor

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

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

Minor comments, but looks good!

prefect_snowflake/credentials.py Outdated Show resolved Hide resolved
prefect_snowflake/credentials.py Outdated Show resolved Hide resolved
prefect_snowflake/credentials.py Outdated Show resolved Hide resolved
tests/test_credentials.py Outdated Show resolved Hide resolved
tests/test_credentials.py Outdated Show resolved Hide resolved
tests/test_credentials.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

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

Thanks!

@desertaxle desertaxle merged commit 6fa36a1 into main Dec 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants