This is an automated email from the ASF dual-hosted git repository.
uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 8f4c1a6860 Add directive to render a list of URI schemes (#37700)
8f4c1a6860 is described below
commit 8f4c1a6860d4fa67522714b6ac8b63ab49f12c0d
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Tue Feb 27 18:34:06 2024 +0800
Add directive to render a list of URI schemes (#37700)
---
.../core-extensions/dataset-schemes.rst | 28 ++++++++++++++++++
docs/exts/operators_and_hooks_ref.py | 12 ++++++++
docs/exts/templates/dataset-uri-schemes.rst.jinja2 | 34 ++++++++++++++++++++++
3 files changed, 74 insertions(+)
diff --git a/docs/apache-airflow-providers/core-extensions/dataset-schemes.rst
b/docs/apache-airflow-providers/core-extensions/dataset-schemes.rst
new file mode 100644
index 0000000000..aa84bf08af
--- /dev/null
+++ b/docs/apache-airflow-providers/core-extensions/dataset-schemes.rst
@@ -0,0 +1,28 @@
+ .. 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.
+
+Dataset URI Schemes
+-------------------
+
+This is a summary of all Apache Airflow Community provided implementations of
dataset URI schemes
+exposed via Airflow core and community-managed providers.
+
+See :doc:`documentation on Datasets
<apache-airflow:authoring-and-scheduling/datasets>` for details on how dataset
URIs work.
+
+.. airflow-dataset-schemes::
+ :tags: None
+ :header-separator: "
diff --git a/docs/exts/operators_and_hooks_ref.py
b/docs/exts/operators_and_hooks_ref.py
index 413cda59f4..3674b509ef 100644
--- a/docs/exts/operators_and_hooks_ref.py
+++ b/docs/exts/operators_and_hooks_ref.py
@@ -513,6 +513,17 @@ class DeprecationsDirective(BaseJinjaReferenceDirective):
)
+class DatasetSchemeDirective(BaseJinjaReferenceDirective):
+ """Generate list of Dataset URI schemes"""
+
+ def render_content(self, *, tags: set[str] | None, header_separator: str =
DEFAULT_HEADER_SEPARATOR):
+ return _common_render_list_content(
+ header_separator=header_separator,
+ resource_type="dataset-uris",
+ template="dataset-uri-schemes.rst.jinja2",
+ )
+
+
def setup(app):
"""Setup plugin"""
app.add_directive("operators-hooks-ref", OperatorsHooksReferenceDirective)
@@ -527,6 +538,7 @@ def setup(app):
app.add_directive("airflow-executors", ExecutorsDirective)
app.add_directive("airflow-deferrable-operators",
DeferrableOperatorDirective)
app.add_directive("airflow-deprecations", DeprecationsDirective)
+ app.add_directive("airflow-dataset-schemes", DatasetSchemeDirective)
return {"parallel_read_safe": True, "parallel_write_safe": True}
diff --git a/docs/exts/templates/dataset-uri-schemes.rst.jinja2
b/docs/exts/templates/dataset-uri-schemes.rst.jinja2
new file mode 100644
index 0000000000..aa247507be
--- /dev/null
+++ b/docs/exts/templates/dataset-uri-schemes.rst.jinja2
@@ -0,0 +1,34 @@
+{#
+ 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.
+#}
+
+Core
+{{ header_separator * 4 }}
+
+- ``file``
+
+{% for _, provider in items.items() -%}
+
+{{ provider['name'] }}
+{{ header_separator * (provider['name']|length) }}
+
+{% for uri_entry in provider['dataset-uris'] -%}
+- {% for scheme in uri_entry['schemes'] %}``{{ scheme }}``{% if not loop.last
%}, {% endif %}{% endfor %}
+{% endfor %}
+
+{% endfor %}