-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Sensor section in the Azure providers docs (#32299)
* added transfers section: * spell * spell * spell * static-checks * fixed static checks * doc added for local_to_wasb * added sensors section * added sensors section * fixed static check
- Loading branch information
Showing
8 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. |
53 changes: 53 additions & 0 deletions
53
airflow/providers/microsoft/azure/example_dag/example_cosmos_document_sensor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# | ||
# 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. | ||
""" | ||
Example Airflow DAG that senses document in Azure Cosmos DB. | ||
This DAG relies on the following OS environment variables | ||
* DATABASE_NAME - Target CosmosDB database_name. | ||
* COLLECTION_NAME - Target CosmosDB collection_name. | ||
* DOCUMENT_ID - The ID of the target document. | ||
""" | ||
from __future__ import annotations | ||
|
||
import os | ||
from datetime import datetime | ||
|
||
from airflow.models import DAG | ||
from airflow.providers.microsoft.azure.sensors.cosmos import AzureCosmosDocumentSensor | ||
|
||
DATABASE_NAME = os.environ.get("DATABASE_NAME", "example-database-name") | ||
COLLECTION_NAME = os.environ.get("COLLECTION_NAME", "example-collection-name") | ||
DOCUMENT_ID = os.environ.get("DOCUMENT_ID", "example-document-id") | ||
|
||
|
||
with DAG( | ||
"example_cosmos_document_sensor", | ||
start_date=datetime(2022, 8, 8), | ||
catchup=False, | ||
tags=["example"], | ||
) as dag: | ||
# [START cosmos_document_sensor] | ||
azure_wasb_sensor = AzureCosmosDocumentSensor( | ||
database_name=DATABASE_NAME, | ||
collection_name=COLLECTION_NAME, | ||
document_id=DOCUMENT_ID, | ||
task_id="cosmos_document_sensor", | ||
) | ||
# [END cosmos_document_sensor] |
61 changes: 61 additions & 0 deletions
61
airflow/providers/microsoft/azure/example_dag/example_wasb_sensors.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# | ||
# 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. | ||
""" | ||
Example Airflow DAG that senses blob(s) in Azure Blob Storage. | ||
This DAG relies on the following OS environment variables | ||
* CONTAINER_NAME - The container under which to look for the blob. | ||
* BLOB_NAME - The name of the blob to match. | ||
* PREFIX - The blob with the specified prefix to match. | ||
""" | ||
from __future__ import annotations | ||
|
||
import os | ||
from datetime import datetime | ||
|
||
from airflow.models import DAG | ||
from airflow.providers.microsoft.azure.sensors.wasb import WasbBlobSensor, WasbPrefixSensor | ||
|
||
CONTAINER_NAME = os.environ.get("CONTAINER_NAME", "example-container-name") | ||
BLOB_NAME = os.environ.get("BLOB_NAME", "example-blob-name") | ||
PREFIX = os.environ.get("PREFIX", "example-prefix") | ||
|
||
|
||
with DAG( | ||
"example_wasb_sensors", | ||
start_date=datetime(2022, 8, 8), | ||
catchup=False, | ||
tags=["example"], | ||
) as dag: | ||
# [START wasb_blob_sensor] | ||
azure_wasb_sensor = WasbBlobSensor( | ||
container_name=CONTAINER_NAME, | ||
blob_name=BLOB_NAME, | ||
task_id="wasb_sense_blob", | ||
) | ||
# [END wasb_blob_sensor] | ||
|
||
# [START wasb_prefix_sensor] | ||
azure_wasb_prefix_sensor = WasbPrefixSensor( | ||
container_name=CONTAINER_NAME, | ||
blob_name=BLOB_NAME, | ||
prefix=PREFIX, | ||
task_id="wasb_sense_prefix", | ||
) | ||
# [END wasb_prefix_sensor] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
docs/apache-airflow-providers-microsoft-azure/sensors/cosmos_document_sesnor.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.. 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. | ||
Azure Cosmos DB | ||
================== | ||
Cosmos Database (DB) is a globally distributed, low latency, multi-model database for managing data at large scales. | ||
It is a cloud-based NoSQL database offered as a PaaS (Platform as a Service) from Microsoft Azure. | ||
It is a highly available, high throughput, reliable database and is often called a serverless database. | ||
Cosmos database contains the Azure Document DB and is available everywhere. | ||
|
||
Azure Cosmos Document Sensor | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Checks for the existence of a document which matches the given query in CosmosDB. | ||
:class:`~airflow.providers.microsoft.azure.sensors.cosmos.AzureCosmosDocumentSensor` | ||
|
||
.. exampleinclude:: /../../airflow/providers/microsoft/azure/example_dag/example_cosmos_document_sensor.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START cosmos_document_sensor] | ||
:end-before: [END cosmos_document_sensor] |
27 changes: 27 additions & 0 deletions
27
docs/apache-airflow-providers-microsoft-azure/sensors/index.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.. 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. | ||
Microsoft Azure Sensors | ||
======================= | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:glob: | ||
|
||
* |
48 changes: 48 additions & 0 deletions
48
docs/apache-airflow-providers-microsoft-azure/sensors/wasb_sensors.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.. 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. | ||
Azure Blob Storage | ||
================== | ||
The Blob service stores text and binary data as objects in the cloud. | ||
The Blob service offers the following three resources: the storage account, containers, and blobs. | ||
Within your storage account, containers provide a way to organize sets of blobs. | ||
For more information about the service visit `Azure Blob Storage API documentation <https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api>`_. | ||
This page shows how to check for blobs in a particular container. | ||
|
||
Wasb Blob Sensor | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Waits for a blob to arrive on Azure Blob Storage. | ||
:class:`~airflow.providers.microsoft.azure.sensors.wasb.WasbBlobSensor` | ||
|
||
.. exampleinclude:: /../../airflow/providers/microsoft/azure/example_dag/example_wasb_sensors.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START wasb_blob_sensor] | ||
:end-before: [END wasb_blob_sensor] | ||
|
||
Wasb Prefix Sensor | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Waits for blobs matching a prefix to arrive on Azure Blob Storage. | ||
:class:`~airflow.providers.microsoft.azure.sensors.wasb.WasbPrefixSensor` | ||
|
||
.. exampleinclude:: /../../airflow/providers/microsoft/azure/example_dag/example_wasb_sensors.py | ||
:language: python | ||
:dedent: 4 | ||
:start-after: [START wasb_prefix_sensor] | ||
:end-before: [END wasb_prefix_sensor] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1056,6 +1056,7 @@ ot | |
otel | ||
overridable | ||
oversubscription | ||
PaaS | ||
Pagerduty | ||
pagerduty | ||
pageviews | ||
|