amoghrajesh commented on code in PR #70581:
URL: https://github.com/apache/airflow/pull/70581#discussion_r3674015460
##########
providers/dbt/cloud/src/airflow/providers/dbt/cloud/hooks/dbt.py:
##########
@@ -341,13 +343,30 @@ async def get_job_status(
job_run_status: int = response["data"]["status"]
return job_run_status
+ @staticmethod
+ def _require_password(conn: Connection) -> Connection:
+ if not conn.password:
+ raise AirflowException("An API token is required to connect to dbt
Cloud.")
+ return conn
+
@cached_property
def connection(self) -> Connection:
Review Comment:
This is a general issue, not dbt specific and any hook that lazily resolves
a `Connection` via a sync `cached_property` and gets called from inside an
async triggers run() loop can hit it. tasl SDK fixed the general case in
#55812, and this same "sync cached_property read from async code".
dbt cloud `_resolve_account_id_async()` had already been fixed similarly
(#56791) but the connection headers path was missed thats what this PR closes.
Added a docstring on connection cross referencing `_resolve_connection_async()`
so this does not get missed again on this hook.
--
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]