You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kacpermuda (via GitHub)" <gi...@apache.org> on 2024/06/11 11:58:45 UTC

[PR] WIP - translate AIP-60 URI to OpenLineage [airflow]

kacpermuda opened a new pull request, #40173:
URL: https://github.com/apache/airflow/pull/40173

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   #38767
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675498628


##########
airflow/datasets/__init__.py:
##########
@@ -50,6 +50,13 @@ def _get_uri_normalizer(scheme: str) -> Callable[[SplitResult], SplitResult] | N
     return ProvidersManager().dataset_uri_handlers.get(scheme)
 
 
+def _get_normalized_scheme(uri: str) -> str | None:
+    parsed = urllib.parse.urlsplit(uri)
+    if not parsed.scheme:
+        return None

Review Comment:
   Removed returning None and adjusted the conditions everywhere.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1686379791


##########
generated/provider_dependencies.json:
##########
@@ -404,6 +404,7 @@
     "devel-deps": [],
     "plugins": [],
     "cross-providers-deps": [
+      "common.compat",

Review Comment:
   That's automated detection of cross-provider dependencies.
   
   It's added automatically when one provider imports another (which is the case here). 
   
   But in your case you also need to add `common.compat>=1.1.0" as explicit dependency of the provider when you are using features from upcoming 1.1. 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675179047


##########
airflow/datasets/__init__.py:
##########
@@ -66,7 +73,8 @@ def _sanitize_uri(uri: str) -> str:
     parsed = urllib.parse.urlsplit(uri)
     if not parsed.scheme and not parsed.netloc:  # Does not look like a URI.
         return uri
-    normalized_scheme = parsed.scheme.lower()
+    if (normalized_scheme := _get_normalized_scheme(uri)) is None:
+        return uri

Review Comment:
   … while you could just do
   
   ```python
   if not (normalized_scheme := parsed.scheme.lower()):
       return uri
   ```
   



##########
airflow/datasets/__init__.py:
##########
@@ -50,6 +50,13 @@ def _get_uri_normalizer(scheme: str) -> Callable[[SplitResult], SplitResult] | N
     return ProvidersManager().dataset_uri_handlers.get(scheme)
 
 
+def _get_normalized_scheme(uri: str) -> str | None:
+    parsed = urllib.parse.urlsplit(uri)
+    if not parsed.scheme:
+        return None

Review Comment:
   Why not just return an empty string? That’s the default behaviour of urlsplit. It’s weird you take the effort to define a new function to check the default behaviour, convert it to None, and then introduce an extra check for that new None possibility you introduced yourself.



##########
airflow/datasets/__init__.py:
##########
@@ -182,6 +190,28 @@ def __eq__(self, other: Any) -> bool:
     def __hash__(self) -> int:
         return hash(self.uri)
 
+    @property
+    def normalized_uri(self) -> str | None:
+        """
+        Returns the normalized and AIP-60 compliant URI whenever possible.
+
+        If we can't retrieve the scheme from URI or no normalizer is provided or if parsing fails,
+        it returns None.
+
+        If a normalizer for the scheme exists and parsing is successful we return the normalizer result.
+        """
+        if (normalized_scheme := _get_normalized_scheme(self.uri)) is None:
+            return None

Review Comment:
   and same here.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "mobuchowski (via GitHub)" <gi...@apache.org>.
mobuchowski commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1686384032


##########
generated/provider_dependencies.json:
##########
@@ -404,6 +404,7 @@
     "devel-deps": [],
     "plugins": [],
     "cross-providers-deps": [
+      "common.compat",

Review Comment:
   @potiuk not that I disagree with that mechanism - I think capturing implicit dependencies is fine - but should it have explicit dependency when it only imports stuff behind `TYPE_CHECKING`? 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675476510


##########
airflow/datasets/__init__.py:
##########
@@ -118,6 +118,23 @@ def coerce_to_uri(value: str | Dataset) -> str:
     return _sanitize_uri(str(value))
 
 
+def is_uri_normalized(uri: str) -> bool:

Review Comment:
   Yes, I agree, the combination of my naming and implementation was not correct.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "dolfinus (via GitHub)" <gi...@apache.org>.
dolfinus commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1672110969


##########
tests/providers/common/io/datasets/test_file.py:
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from urllib.parse import urlsplit, urlunsplit
+
+import pytest
+from openlineage.client.run import Dataset as OpenLineageDataset
+
+from airflow.datasets import Dataset
+from airflow.providers.common.io.datasets.file import convert_dataset_to_openlineage, sanitize_uri
+
+
+@pytest.mark.parametrize(
+    ("uri", "expected"),
+    (
+        ("file:///valid/path/", "file:///valid/path/"),
+        ("file://C://dir/file", "file://C://dir/file"),
+    ),
+)
+def test_sanitize_uri_valid(uri, expected):
+    result = sanitize_uri(urlsplit(uri))
+    assert urlunsplit(result) == expected
+
+
+@pytest.mark.parametrize("uri", ("file://",))
+def test_sanitize_uri_invalid(uri):
+    with pytest.raises(ValueError):
+        sanitize_uri(urlsplit(uri))
+
+
+@pytest.mark.parametrize(
+    ("uri", "ol_dataset"),
+    (
+        ("file:///valid/path/", OpenLineageDataset(namespace="file://", name="/valid/path")),
+        ("file:///valid/path", OpenLineageDataset(namespace="file://", name="/valid/path")),
+        ("file://C://dir/file", OpenLineageDataset(namespace="file://C:", name="//dir/file")),

Review Comment:
   Should `C:` be a `netloc` part of URL (dataset namespace), or a part of file path (dataset name)?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675472243


##########
airflow/datasets/__init__.py:
##########
@@ -182,6 +190,28 @@ def __eq__(self, other: Any) -> bool:
     def __hash__(self) -> int:
         return hash(self.uri)
 
+    @property
+    def normalized_uri(self) -> str | None:

Review Comment:
   I wrote it in the provider at first and it's not used anywhere else yet, but it relates closely to a Dataset class and it uses only "core" mechanisms related to the URI so i thought this is a suitable place for it and it made a lot of sense to me to keep it closer to the Dataset class. Does it make sense?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1673988633


##########
tests/providers/common/io/datasets/test_file.py:
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from urllib.parse import urlsplit, urlunsplit
+
+import pytest
+from openlineage.client.run import Dataset as OpenLineageDataset
+
+from airflow.datasets import Dataset
+from airflow.providers.common.io.datasets.file import convert_dataset_to_openlineage, sanitize_uri
+
+
+@pytest.mark.parametrize(
+    ("uri", "expected"),
+    (
+        ("file:///valid/path/", "file:///valid/path/"),
+        ("file://C://dir/file", "file://C://dir/file"),
+    ),
+)
+def test_sanitize_uri_valid(uri, expected):
+    result = sanitize_uri(urlsplit(uri))
+    assert urlunsplit(result) == expected
+
+
+@pytest.mark.parametrize("uri", ("file://",))
+def test_sanitize_uri_invalid(uri):
+    with pytest.raises(ValueError):
+        sanitize_uri(urlsplit(uri))
+
+
+@pytest.mark.parametrize(
+    ("uri", "ol_dataset"),
+    (
+        ("file:///valid/path/", OpenLineageDataset(namespace="file://", name="/valid/path")),
+        ("file:///valid/path", OpenLineageDataset(namespace="file://", name="/valid/path")),
+        ("file://C://dir/file", OpenLineageDataset(namespace="file://C:", name="//dir/file")),

Review Comment:
   It should be in the path, i think. I improved the test, used another valid uri format.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675461319


##########
airflow/datasets/__init__.py:
##########
@@ -50,6 +50,13 @@ def _get_uri_normalizer(scheme: str) -> Callable[[SplitResult], SplitResult] | N
     return ProvidersManager().dataset_uri_handlers.get(scheme)
 
 
+def _get_normalized_scheme(uri: str) -> str | None:
+    parsed = urllib.parse.urlsplit(uri)
+    if not parsed.scheme:
+        return None

Review Comment:
   The reason behind a separate function was that i did not feel comfortable just re-using the `parsed.scheme.lower()`. I felt like this logic can easily be changed here and we will not be aware of it in the provider, so by creating another layer we can all use the same function. This conversion to None makes no sense and I'll remove it, but the separate function makes sense to me as we start using this normalized scheme as a key in multiple places.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675472243


##########
airflow/datasets/__init__.py:
##########
@@ -182,6 +190,28 @@ def __eq__(self, other: Any) -> bool:
     def __hash__(self) -> int:
         return hash(self.uri)
 
+    @property
+    def normalized_uri(self) -> str | None:

Review Comment:
   I wrote it in the provider at first and it's not used anywhere else yet, but it relates closely to a Dataset class and it uses only "core" mechanisms related to the URI so i thought this is a suitable place for it and it mad a lot of sense to me, to keep it closer to the Dataset class. Does it make sense?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1686415207


##########
generated/provider_dependencies.json:
##########
@@ -404,6 +404,7 @@
     "devel-deps": [],
     "plugins": [],
     "cross-providers-deps": [
+      "common.compat",

Review Comment:
   BTW. It's the first time it happened, generally I think providers are using other providers more "extensively".



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1648642686


##########
airflow/datasets/__init__.py:
##########
@@ -118,6 +118,23 @@ def coerce_to_uri(value: str | Dataset) -> str:
     return _sanitize_uri(str(value))
 
 
+def is_uri_normalized(uri: str) -> bool:

Review Comment:
   So, just to clarify, currently uri normalizers defined for some schemas (added in AIP-60) do not actually normalize the URI? Maybe we should change that by modifying the normalizers and adding some tests? 
   
   I've added `Dataset.normalized_uri` property, does it make sense?
   
   ~~The other option that you mentioned I can just change the name to `_is_uri_compliant` (why can't it be public?), and the when translating to OpenLineage we would have to deal with whatever is returned by the normalizer, without assuming the URI is normalized - so probably just adding more tests for different cases of the URI.~~



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675155261


##########
airflow/datasets/__init__.py:
##########
@@ -118,6 +118,23 @@ def coerce_to_uri(value: str | Dataset) -> str:
     return _sanitize_uri(str(value))
 
 
+def is_uri_normalized(uri: str) -> bool:

Review Comment:
   This has been changed but I think what I was trying to say is, the way you implemented this function, it would return True for non-normalised URIs. The normalisation function always normalises the URI, but you didn’t use that normalised result, so the function only checks if the input _can_ be normalised, not if it _is already_ normalised as the name suggests.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1686326241


##########
generated/provider_dependencies.json:
##########
@@ -404,6 +404,7 @@
     "devel-deps": [],
     "plugins": [],
     "cross-providers-deps": [
+      "common.compat",

Review Comment:
   Not really sure why, but this was added: https://github.com/apache/airflow/actions/runs/10038905531/job/27741833243



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "mobuchowski (via GitHub)" <gi...@apache.org>.
mobuchowski merged PR #40173:
URL: https://github.com/apache/airflow/pull/40173


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675473322


##########
airflow/datasets/__init__.py:
##########
@@ -66,7 +73,8 @@ def _sanitize_uri(uri: str) -> str:
     parsed = urllib.parse.urlsplit(uri)
     if not parsed.scheme and not parsed.netloc:  # Does not look like a URI.
         return uri
-    normalized_scheme = parsed.scheme.lower()
+    if (normalized_scheme := _get_normalized_scheme(uri)) is None:
+        return uri

Review Comment:
   Addressed in the above discussion.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1686410461


##########
generated/provider_dependencies.json:
##########
@@ -404,6 +404,7 @@
     "devel-deps": [],
     "plugins": [],
     "cross-providers-deps": [
+      "common.compat",

Review Comment:
   I believe so. Compat must be installed in order to use the new method. Maybe we could add some feature to mark it as optional if you think it makes sense in this case, but I am not sure if it's really optional. I am not sure if just TYPE_CHECKING is enough - generally the assumption was that if you use or expect anything coming from different providers, it is added as cross-dependency. For example it is also used to see if you should run tests for the other provider if the "cross-related" one has been modified (and in this case it's good because it mght cause problems and failing tests if it did not.
   
   FIY the code doing it is here:
   
   https://github.com/apache/airflow/blob/e30f8102b2dfc2c99454c99c286138754e4a1f1c/scripts/ci/pre_commit/update_providers_dependencies.py#L167
   
   So if you think we can improve that ... :) 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on PR #40173:
URL: https://github.com/apache/airflow/pull/40173#issuecomment-2220124220

   I believe this PR is ready to be reviewed, however it should probably NOT be merged before #40335 gets merged.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675472243


##########
airflow/datasets/__init__.py:
##########
@@ -182,6 +190,28 @@ def __eq__(self, other: Any) -> bool:
     def __hash__(self) -> int:
         return hash(self.uri)
 
+    @property
+    def normalized_uri(self) -> str | None:

Review Comment:
   I wrote it in the provider at first and it's not used anywhere else yet, but it relates closely to a Dataset class and it uses only "core" mechanisms related to the URI so i thought this is a suitable place for it and it makes a lot of sense ot keep it closer to the Dataset class. Does it make sense?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "kacpermuda (via GitHub)" <gi...@apache.org>.
kacpermuda commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675473700


##########
airflow/datasets/__init__.py:
##########
@@ -182,6 +190,28 @@ def __eq__(self, other: Any) -> bool:
     def __hash__(self) -> int:
         return hash(self.uri)
 
+    @property
+    def normalized_uri(self) -> str | None:
+        """
+        Returns the normalized and AIP-60 compliant URI whenever possible.
+
+        If we can't retrieve the scheme from URI or no normalizer is provided or if parsing fails,
+        it returns None.
+
+        If a normalizer for the scheme exists and parsing is successful we return the normalizer result.
+        """
+        if (normalized_scheme := _get_normalized_scheme(self.uri)) is None:
+            return None

Review Comment:
   Addressed in the above discussion.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AIP-62] Translate AIP-60 URI to OpenLineage [airflow]

Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr commented on code in PR #40173:
URL: https://github.com/apache/airflow/pull/40173#discussion_r1675195217


##########
airflow/datasets/__init__.py:
##########
@@ -182,6 +190,28 @@ def __eq__(self, other: Any) -> bool:
     def __hash__(self) -> int:
         return hash(self.uri)
 
+    @property
+    def normalized_uri(self) -> str | None:

Review Comment:
   Do we intend to use this anywhere else? This logic can simply live in the OL provider, from what I can tell.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org