-
Notifications
You must be signed in to change notification settings - Fork 117
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
SNOWVATION: Replace parameter boilerplate with utility classes. #2751
base: main
Are you sure you want to change the base?
Conversation
72c910b
to
0f2d9d2
Compare
def conf(self) -> RuntimeConfig: | ||
def conf(self) -> SettingStore: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably keep the name same for migration sake: https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.conf.RuntimeConfig.html
], | ||
"parameter_name", ["auto_clean_up_temp_table_enabled", "cte_optimization_enabled"] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge artifact
session.auto_clean_up_temp_table_enabled = True | ||
assert session.auto_clean_up_temp_table_enabled is True | ||
assert "auto_clean_up_temp_table_enabled is experimental" in caplog.text | ||
session.auto_clean_up_temp_table_enabled = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we not raise warning only when we enable the param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning is only raised when setting to a non-default value.
""" | ||
|
||
name: str | ||
description: str | None = field(default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: str | None = field(default=None) | |
description: Optional[str] = field(default=None) |
nit: we follow this style in the repo.
would it be easy to cover changes made in this PR: #2673 |
That wouldn't be too hard. I think I'd recommend downgrading from an error to a warning though so that users can be aware that they should clean things up. |
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-NNNNNNN
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
The goal of this refactor is to provide a central location for defining parameters and other snowpark-python configuration. This should make it easier to add additional parameters in the future as well as gate more deprecated or exerimental logic behind parameters.
Session parmeters are now all added in
Session._initialize_config
. All definition needed for them should happen there.Package level confuguration settings should similarly all be defined in src/snowflake/snowpark/_internal/config.py
Parameters and package level configs can all be accessed via session.conf.
As part of this change I've moved all of the session level parameters over to the new settings style, but there are likely package level configuration options that I have missed. For now the parameters that are exposed as properties of the session object remain available in this manner, but in the future we should standardize the access method to be through the config object.