You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Sharashchandra (via GitHub)" <gi...@apache.org> on 2025/05/08 10:23:46 UTC
[PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Sharashchandra opened a new pull request, #50344:
URL: https://github.com/apache/airflow/pull/50344
Bug introduced in: https://github.com/apache/airflow/pull/49482
The infinite loop was caused by calling the property self._get_conn_params in the property self.account_identifier. The self.account_identifier was used in the get_oauth_token function, thus resulting in the infinite loop of calls to self._get_conn_params
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
---
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "Sharashchandra (via GitHub)" <gi...@apache.org>.
Sharashchandra commented on code in PR #50344:
URL: https://github.com/apache/airflow/pull/50344#discussion_r2079484996
##########
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -205,7 +205,7 @@ def get_oauth_token(self, conn_config: dict | None = None) -> str:
if conn_config is None:
conn_config = self._get_conn_params
- url = f"{self.account_identifier}.snowflakecomputing.com/oauth/token-request"
+ url = f"{conn_config['account']}.snowflakecomputing.com/oauth/token-request"
Review Comment:
We need to add https:// at the beginning, not part of the account. Added that and pushed the code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2862756834
Tests are still failing
`FAILED providers/snowflake/tests/unit/snowflake/hooks/test_snowflake.py::TestPytestSnowflakeHook::test_get_oauth_token - AssertionError: expected call not found.`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2862594670
Yes, most probably, the property is now a method and needs to be updated in the test accordingly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "Sharashchandra (via GitHub)" <gi...@apache.org>.
Sharashchandra commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2862597746
Fixed that. Reverting the account_identifier property to remain as it was before because it's used in multiple places in the SnowflakeSqlApiHook
I'm using the account name to construct the url for snowflake oauth.
We don't need the region to be used in the url anymore as that's a legacy valid url
https://docs.snowflake.com/en/user-guide/organizations-connect#label-connecting-via-url
cc: @eladkal @bugraoz93
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal merged PR #50344:
URL: https://github.com/apache/airflow/pull/50344
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on code in PR #50344:
URL: https://github.com/apache/airflow/pull/50344#discussion_r2079479033
##########
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -205,7 +205,7 @@ def get_oauth_token(self, conn_config: dict | None = None) -> str:
if conn_config is None:
conn_config = self._get_conn_params
- url = f"{self.account_identifier}.snowflakecomputing.com/oauth/token-request"
+ url = f"{conn_config['account']}.snowflakecomputing.com/oauth/token-request"
Review Comment:
Okay, I found it, but don't we need `http://` at the beginning, or is that coming from the `account`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on code in PR #50344:
URL: https://github.com/apache/airflow/pull/50344#discussion_r2079476061
##########
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -205,7 +205,7 @@ def get_oauth_token(self, conn_config: dict | None = None) -> str:
if conn_config is None:
conn_config = self._get_conn_params
- url = f"{self.account_identifier}.snowflakecomputing.com/oauth/token-request"
+ url = f"{conn_config['account']}.snowflakecomputing.com/oauth/token-request"
Review Comment:
Where is this `account` filled in connection?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "Sharashchandra (via GitHub)" <gi...@apache.org>.
Sharashchandra commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2862547103
cc: @eladkal @gopidesupavan @bugraoz93
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2862574503
Tests are failing
`FAILED providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py::TestSnowflakeSqlApiHook::test_proper_parametrization_of_execute_query_api_request[test_hook_params0-select i from user_test order by i;-1-expected_payload0-expected_response0] - AttributeError: 'SnowflakeSqlApiHook' object has no attribute 'account_identifier'`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "bugraoz93 (via GitHub)" <gi...@apache.org>.
bugraoz93 commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2862934011
Yes, because we remove the region now tests are expecting it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(snowflake_oauth): Fix infinite recursive call of _get_conn_params while getting oauth token from snowflake [airflow]
Posted by "Sharashchandra (via GitHub)" <gi...@apache.org>.
Sharashchandra commented on PR #50344:
URL: https://github.com/apache/airflow/pull/50344#issuecomment-2863244961
Fixed the test cases, eveything is passing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org