Mark Snowflake connection form Proxy Port field optional#65444
Open
nikhilcss97 wants to merge 2 commits intoapache:mainfrom
Open
Mark Snowflake connection form Proxy Port field optional#65444nikhilcss97 wants to merge 2 commits intoapache:mainfrom
Proxy Port field optional#65444nikhilcss97 wants to merge 2 commits intoapache:mainfrom
Conversation
Signed-off-by: Nikhil Gupta <[email protected]>
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a silent Save failure on the Snowflake connection form in the Airflow
web UI when the Proxy Port field is left blank.
SnowflakeHook.get_connection_form_widgetscurrently declares the field as:IntegerFieldwithoutOptional()fails WTForms validation on empty inputbecause an empty string cannot be coerced to
int. FAB then silentlyre-renders the form without persisting any changes, so the Save button
appears to do nothing when the optional proxy fields are not filled in.
Meanwhile the runtime (
SnowflakeHook._get_conn_params) already treatsproxy_portas optional and only applies it when truthy, and every non-UIpath (CLI, env-vars, REST API, secrets backends) accepts an absent
proxy_port. The UI was the only code path enforcing it, and unintentionally.Fix
Add
validators=[Optional()]to theproxy_portwidget so WTFormsshort-circuits validation for empty input. Also attach
BS3TextFieldWidget()to match the style of the other proxy widgets.
Tests
Added
test_get_connection_form_widgets_proxy_port_is_optionalinproviders/snowflake/tests/unit/snowflake/hooks/test_snowflake.pycovering:Optional()is present in theproxy_portfield validatorsproxy_port=""and coerces toNoneproxy_port="8080"and coerces to8080type-checking is preserved
Reproduction (pre-fix)
apache-airflow-providers-snowflake>=6.9.0.Snowflake, fill in the required fields, leave the four Proxy fields
blank.
connection is not created.
0) in Proxy Port and click Save. Theconnection is created.
Post-fix: step 3 succeeds, and step 4 is no longer necessary.
Scope and safety
behavior is unchanged because
_get_conn_paramsalready guards onif proxy_port:.proxy_port; this aligns the UI with them.test case.
Related
conn-fieldsmigrated to YAML in 6.10.0: Add missing conn-fields for providers migrated to yaml #62116closes: #65443
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Sonnet following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.