Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions airflow/providers/jdbc/example_dags/__init__.py

This file was deleted.

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

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

Expand Down
4 changes: 2 additions & 2 deletions docs/apache-airflow-providers-jdbc/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ commands against a database (or data storage) accessible via a JDBC driver.
The :doc:`JDBC Connection <connections/jdbc>` must be passed as
``jdbc_conn_id``.

.. exampleinclude:: /../../airflow/providers/jdbc/example_dags/example_jdbc_queries.py
.. exampleinclude:: /../../tests/system/providers/jdbc/example_jdbc_queries.py
:language: python
:start-after: [START howto_operator_jdbc]
:end-before: [END howto_operator_jdbc]
Expand All @@ -87,7 +87,7 @@ Templating
You can use :ref:`Jinja templates <concepts:jinja-templating>` to parameterize
``sql``.

.. exampleinclude:: /../../airflow/providers/jdbc/example_dags/example_jdbc_queries.py
.. exampleinclude:: /../../tests/system/providers/jdbc/example_jdbc_queries.py
:language: python
:start-after: [START howto_operator_jdbc_template]
:end-before: [END howto_operator_jdbc_template]
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

"""Example DAG demonstrating the usage of the JdbcOperator."""

import os
from datetime import datetime, timedelta

from airflow import DAG
Expand All @@ -28,8 +29,11 @@
from airflow.operators.dummy import DummyOperator as EmptyOperator # type: ignore
from airflow.providers.jdbc.operators.jdbc import JdbcOperator

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_jdbc_operator"

with DAG(
dag_id='example_jdbc_operator',
dag_id=DAG_ID,
schedule_interval='0 0 * * *',
start_date=datetime(2021, 1, 1),
dagrun_timeout=timedelta(minutes=60),
Expand Down Expand Up @@ -58,3 +62,14 @@
# [END howto_operator_jdbc]

delete_data >> insert_data >> run_this_last

from tests.system.utils.watcher import watcher

# This test needs watcher in order to properly mark success/failure
# when "tearDown" task with trigger rule is part of the DAG
list(dag.tasks) >> watcher()

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)