Skip to content

Commit

Permalink
AIP-47 - Migrate cassandra DAGs to new design apache#22439
Browse files Browse the repository at this point in the history
  • Loading branch information
chethanuk committed Jun 5, 2022
1 parent acf8951 commit a7f1d9f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
16 changes: 0 additions & 16 deletions airflow/providers/apache/cassandra/example_dags/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-apache-cassandra/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Content
:maxdepth: 1
:caption: Resources

Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/apache/cassandra/example_dags>
Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/apache/cassandra>
PyPI Repository <https://pypi.org/project/apache-airflow-providers-apache-cassandra/>
Installing from sources <installing-providers-from-sources>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Use the ``keys`` parameter to poke until the provided record is found. The exist
Example use of these sensors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. exampleinclude:: /../../airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py
.. exampleinclude:: /../../tests/system/providers/apache/cassandra/example_cassandra_dag.py
:language: python
:start-after: [START howto_operator_cassandra_sensors]
:end-before: [END howto_operator_cassandra_sensors]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@
Example Airflow DAG to check if a Cassandra Table and a Records exists
or not using `CassandraTableSensor` and `CassandraRecordSensor`.
"""

import os
from datetime import datetime

from airflow.models import DAG
from airflow.providers.apache.cassandra.sensors.record import CassandraRecordSensor
from airflow.providers.apache.cassandra.sensors.table import CassandraTableSensor

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_cassandra_operator"
# [START howto_operator_cassandra_sensors]
with DAG(
dag_id='example_cassandra_operator',
dag_id=DAG_ID,
schedule_interval=None,
start_date=datetime(2021, 1, 1),
default_args={'table': 'keyspace_name.table_name'},
Expand All @@ -42,3 +46,8 @@

record_sensor = CassandraRecordSensor(task_id="cassandra_record_sensor", keys={"p1": "v1", "p2": "v2"})
# [END howto_operator_cassandra_sensors]

from tests.system.utils import get_test_run # noqa: E402

# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
test_run = get_test_run(dag)

0 comments on commit a7f1d9f

Please sign in to comment.