Pyasma commented on code in PR #56298:
URL: https://github.com/apache/airflow/pull/56298#discussion_r2425203168
##########
providers/presto/src/airflow/providers/presto/hooks/presto.py:
##########
@@ -150,6 +150,35 @@ def get_conn(self) -> Connection:
return presto_conn
+ @property
+ def sqlalchemy_url(self) -> URL:
+ """Return a `sqlalchemy.engine.URL` object constructed from the
connection."""
+ conn = self.get_connection(self.get_conn_id())
+ extra = conn.extra_dejson or {}
+ catalog = extra.get("catalog", "hive")
+ schema = conn.schema
+
+ query = {"protocol": extra.get("protocol", "http"), "source":
extra.get("source", "airflow")}
+
+ if schema:
+ query["schema"] = schema
+
+ url_query_params = {k: v for k, v in query.items() if v is not None}
+ host = str(conn.host) if conn.host else "test_host"
+ return URL.create(
+ drivername="presto",
+ username=conn.login or "",
+ password=conn.password or "",
+ host=host,
+ port=conn.port,
+ database=catalog,
+ query=url_query_params,
+ )
Review Comment:
yea you are right i will make changes in 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]