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

Support insecure mode in SnowflakeHook #20106

Merged
merged 3 commits into from
Dec 13, 2021

Conversation

mik-laj
Copy link
Member

@mik-laj mik-laj commented Dec 7, 2021

Close: #19797
CC: @mattpolzin @harishkrao @sfc-gh-turbaszek


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

return False
elif value.lower() == 'true':
return True
return value
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about the return - what it means it terms of boolean value?

Copy link
Member Author

Choose a reason for hiding this comment

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

If it can be converted to a bool value then a conversation is performed, but if an incorrect value is passed it is passed unchanged and then the layer below can handle it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the behavior and for an invalid value an exception is now raised

Copy link
Member

Choose a reason for hiding this comment

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

Did you not push the change? The implementation here does not raise, from what I can tell.

Copy link
Member

Choose a reason for hiding this comment

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

Also we have airflow.utils.strings.to_boolean(). Its behaviour is different from the one you have here, but might be more expected since the function is used in other parts of Airflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed now

Copy link
Member Author

Choose a reason for hiding this comment

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

to_boolean looks interesting. Updated and. pushed.

conn_params = self._get_conn_params()
return self._conn_params_to_sqlalchemy_uri(conn_params)

def _conn_params_to_sqlalchemy_uri(self, conn_params):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def _conn_params_to_sqlalchemy_uri(self, conn_params):
def _conn_params_to_sqlalchemy_uri(self, conn_params: Dict):

:return: the created engine.
"""
if engine_kwargs is None:
engine_kwargs = {}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
engine_kwargs = {}
engine_kwargs = engine_kwargs or {}

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Dec 8, 2021
@github-actions
Copy link

github-actions bot commented Dec 8, 2021

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@uranusjr
Copy link
Member

uranusjr commented Dec 8, 2021

Tests are failing.

Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

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

If tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers kind:documentation okay to merge It's ok to merge this PR as it does not require more tests provider:snowflake Issues related to Snowflake provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support insecure mode in Snowflake provider
3 participants