Lee-W commented on code in PR #32786:
URL: https://github.com/apache/airflow/pull/32786#discussion_r1271939625
##########
airflow/providers/tabular/provider.yaml:
##########
@@ -31,6 +31,7 @@ versions:
dependencies:
- apache-airflow>=2.4.0
+ - pyiceberg==0.4.0
Review Comment:
Wondering whether there is a specific reason we need to pin it to 0.4.0?
##########
airflow/providers/tabular/hooks/tabular.py:
##########
@@ -75,19 +77,25 @@ def test_connection(self) -> tuple[bool, str]:
except Exception as e:
return False, str(e)
- def get_conn(self) -> str:
- """Obtain a short-lived access token via a client_id and
client_secret."""
+ def load_rest_catalog(self) -> Catalog:
conn = self.get_connection(self.conn_id)
base_url = conn.host if conn.host else DEFAULT_TABULAR_URL
base_url = base_url.rstrip("/")
client_id = conn.login
client_secret = conn.password
- data = {"client_id": client_id, "client_secret": client_secret,
"grant_type": "client_credentials"}
- response = requests.post(f"{base_url}/{TOKENS_ENDPOINT}", data=data)
- response.raise_for_status()
+ properties = {
+ "type": "rest",
+ "uri": base_url,
+ "credential": f"{client_id}:{client_secret}",
+ "warehouse": conn.schema,
+ }
+ return load_catalog(self.conn_id, **properties)
- return response.json()["access_token"]
+ def get_conn(self) -> str:
+ """Obtain a short-lived access token via a client_id and
client_secret."""
+ cat = self.load_rest_catalog()
Review Comment:
Why do we need to change the implementation of `get_conn`? Will it cause
behavior change?
--
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]