hussein-awala commented on code in PR #34221:
URL: https://github.com/apache/airflow/pull/34221#discussion_r1320289485
##########
airflow/providers/elasticsearch/hooks/elasticsearch.py:
##########
@@ -124,18 +124,8 @@ def get_uri(self) -> str:
host += f":{conn.port}"
uri = f"{conn.conn_type}+{conn.schema}://{login}{host}/"
- extras_length = len(conn.extra_dejson)
- if not extras_length:
- return uri
-
- uri += "?"
-
- for arg_key, arg_value in conn.extra_dejson.items():
- extras_length -= 1
- uri += f"{arg_key}={arg_value}"
-
- if extras_length:
- uri += "&"
+ if conn.extra_dejson:
+ uri += "?" + parse.urlencode(conn.extra_dejson)
Review Comment:
same here
##########
airflow/providers/amazon/aws/operators/sagemaker.py:
##########
@@ -166,9 +167,9 @@ def hook(self):
def path_to_s3_dataset(path) -> Dataset:
from openlineage.client.run import Dataset
- path = path.replace("s3://", "")
- split_path = path.split("/")
- return Dataset(namespace=f"s3://{split_path[0]}",
name="/".join(split_path[1:]), facets={})
+ split = urlsplit(path)
+ name = urlunsplit(split._replace(scheme="", netloc="")).lstrip("/")
+ return Dataset(namespace=f"{split.scheme}://{split.netloc}",
name=name, facets={})
Review Comment:
IMHO this kind of refactor is not safe, a unit test should be added to test
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]