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
17 changes: 0 additions & 17 deletions airflow/providers/neo4j/example_dags/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-neo4j/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/neo4j/example_dags>
Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/neo4j>

.. toctree::
:maxdepth: 1
Expand Down
6 changes: 6 additions & 0 deletions docs/apache-airflow-providers-neo4j/operators/neo4j.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ the connection metadata is structured as follows:
- Neo4j user password
* - Port: int
- Neo4j port

.. exampleinclude:: /../../tests/system/providers/neo4j/example_neo4j.py
:language: python
:dedent: 4
:start-after: [START run_query_neo4j_operator]
:end-before: [END run_query_neo4j_operator]
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,34 @@
"""
Example use of Neo4j related operators.
"""

import os
from datetime import datetime

from airflow import DAG
from airflow.providers.neo4j.operators.neo4j import Neo4jOperator

dag = DAG(
'example_neo4j',
ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_neo4j"

with DAG(
DAG_ID,
start_date=datetime(2021, 1, 1),
tags=['example'],
catchup=False,
)
) as dag:

# [START run_query_neo4j_operator]

neo4j_task = Neo4jOperator(
task_id='run_neo4j_query',
neo4j_conn_id='neo4j_conn_id',
sql='MATCH (tom {name: "Tom Hanks", date: "{{ds}}"}) RETURN tom',
dag=dag,
)

# [START run_query_neo4j_operator]
# [END run_query_neo4j_operator]

neo4j_task = Neo4jOperator(
task_id='run_neo4j_query',
neo4j_conn_id='neo4j_conn_id',
sql='MATCH (tom {name: "Tom Hanks", date: "{{ds}}"}) RETURN tom',
dag=dag,
)
from tests.system.utils import get_test_run # noqa: E402

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