mobuchowski commented on code in PR #40689:
URL: https://github.com/apache/airflow/pull/40689#discussion_r1692787179
##########
airflow/providers/airbyte/hooks/validation.py:
##########
Review Comment:
I think it would be the best to put in under `utils` IMO, it's not really
tied to particular hook other than "code proximity".
##########
airflow/providers/airbyte/hooks/airbyte.py:
##########
@@ -257,3 +271,125 @@ def test_connection(self):
return False, str(e)
finally:
self.method = "POST"
+
+ def get_airbyte_connection_info(self, connection_id: str) -> dict[str,
Any] | None:
+ """
+ Get the connection info for Airbyte.
+
+ :return: The connection info for Airbyte.
+ """
+ if self.api_type == "config":
+ res = self.run(
+ endpoint=f"api/{self.api_version}/connections/get",
+ headers={
+ "accept": "application/json",
+ "authorization": f"Bearer
{self.airbyte_connection.password}",
+ },
+ json={
+ "connectionId": connection_id,
+ },
+ )
+
+ if res.status_code != 200:
+ self.log.error("Error getting connection info: %s", res.text)
+ return None
+
+ valid_connection = is_connection_valid(res.json())
+ if not valid_connection:
+ self.log.warning("Connection is not valid")
Review Comment:
I think it would be best to explain more in the warning what means that
connection is not valid - unless this is something well known by Airbyte users
- who I am not 🙂
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]