Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3075078
neptune analytics initial
Feb 4, 2026
c28fefa
Added NeptuneCreateGraphOperator and supporting files/classes
Feb 19, 2026
820f689
Added private endpoint operators
Mar 4, 2026
ebdbbbc
fixed assignment error
Mar 5, 2026
71aec4c
Fixed type error
Mar 5, 2026
d63f954
fixed another return type error
Mar 5, 2026
0876b77
Fixed assignment error in delete endpoint operator
Mar 5, 2026
d140555
Added NeptuneDeleteGraphOperator and NeptuneStartImportTaskOperator
Mar 16, 2026
d86498d
Fixed prek findings
Mar 16, 2026
6b5c88f
Added NeptuneCancelImportTaskOperator
Mar 16, 2026
398b4d3
Added system tests and fixed errors found during system testing
ellisms Mar 23, 2026
a5540d8
Added additional links for import job and vpce
ellisms Mar 24, 2026
9524958
Updated system and unit tests, and operator fixes
ellisms Mar 26, 2026
46fa89f
Added Neptune Analytics docs
ellisms Mar 26, 2026
b2deb20
added console links to NeptuneCreateGraphWithImportOperator
ellisms Mar 26, 2026
7f8c3a8
Fixed missing operator_extra_links assignment
ellisms Mar 26, 2026
95c0b46
Update providers/amazon/tests/unit/amazon/aws/triggers/test_neptune_a…
ellisms Apr 6, 2026
71b9a27
Update providers/amazon/src/airflow/providers/amazon/aws/operators/ne…
ellisms Apr 6, 2026
4c18486
Fixed issues found in CI
ellisms Apr 6, 2026
ee4155f
Fixed broken test and CI failures
ellisms Apr 7, 2026
933a123
Fixed url typo in provider file
ellisms Apr 7, 2026
e740ab6
Requested PR changes
Apr 12, 2026
054e05b
Added Neptune Analytics exceptions and addressed PR comments
Apr 25, 2026
8c466bb
Fixed mypy errors
Apr 26, 2026
71c5db4
provider update
May 2, 2026
d2cf9b3
Updated system test exception handling based on prek findings
May 2, 2026
a4b2f3d
Fixed calling lower() on None
May 2, 2026
42cb361
Added custom import waiter and addressed PR suggestions
ellisms May 22, 2026
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
8 changes: 8 additions & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ ContainerPort
contentUrl
contextmgr
contrib
convertToIri
copyable
CoreV
coroutine
Expand Down Expand Up @@ -439,6 +440,7 @@ deidentify
DeidentifyTemplate
del
delim
deliverability
deltalake
denylist
dep
Expand Down Expand Up @@ -988,6 +990,7 @@ longblob
lookups
lshift
lxml
m-NCUs
machineTypes
macOS
mae
Expand Down Expand Up @@ -1073,6 +1076,7 @@ nat
natively
nav
navbar
NCUs
nd
ndjson
nearText
Expand Down Expand Up @@ -1101,9 +1105,11 @@ NotFound
notificationChannels
notin
npm
nquads
ns
ntlm
ntpd
ntriples
Nullable
nullable
num
Expand All @@ -1128,6 +1134,7 @@ Oozie
OpenAI
openai
openapi
opencypher
openfaas
OpenID
openlineage
Expand Down Expand Up @@ -1321,6 +1328,7 @@ RaG
RBAC
rbac
rc
rdfxml
RDS
rds
readme
Expand Down
148 changes: 148 additions & 0 deletions providers/amazon/docs/operators/neptune_analytics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
.. 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.

========================
Amazon Neptune Analytics
========================

`Amazon Neptune Analytics <https://docs.aws.amazon.com/neptune-analytics/latest/userguide/what-is-neptune-analytics.html>`__ is a memory-optimized graph database engine for analytics. With Neptune Analytics, you can get insights and find trends by processing large amounts of graph data in seconds.

Prerequisite Tasks
------------------

.. include:: ../_partials/prerequisite_tasks.rst

Generic Parameters
------------------

.. include:: ../_partials/generic_parameters.rst

Operators
---------

.. _howto/operator:NeptuneCreateGraphOperator:

Create a new Neptune Graph
==========================

To create a new Neptune Analytics Graph, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneCreateGraphOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

Comment on lines +42 to +46
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The :class: references point to airflow.providers.amazon.aws.operators.neptune.*, but the Neptune Analytics operators in this PR live in airflow.providers.amazon.aws.operators.neptune_analytics. Update these references throughout this doc so the rendered documentation links to the correct classes.

Copilot uses AI. Check for mistakes.
.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_create_graph]
:end-before: [END howto_operator_neptune_analytics_create_graph]


.. _howto/operator:NeptuneDeleteGraphOperator:

Delete a Neptune Graph
======================

To delete an existing Neptune Analytics Graph, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneDeleteGraphOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_delete_graph]
:end-before: [END howto_operator_neptune_analytics_delete_graph]

.. _howto/operator:NeptuneCreatePrivateGraphEndpointOperator:

Create a Neptune Graph private endpoint
=======================================

To create a VPC Endpoint for connecting to an existing Neptune Graph, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneCreatePrivateGraphEndpointOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_create_private_endpoint]
:end-before: [END howto_operator_neptune_analytics_create_private_endpoint]

.. _howto/operator:NeptuneDeletePrivateGraphEndpointOperator:

Delete a Neptune Graph private endpoint
=======================================

To delete a VPC Endpoint attached to an existing Neptune Graph, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneDeletePrivateGraphEndpointOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_delete_private_endpoint]
:end-before: [END howto_operator_neptune_analytics_delete_private_endpoint]

.. _howto/operator:NeptuneCreateGraphWithImportOperator:

Create a Neptune Graph with a data import task
==============================================

To create a Neptune Analytics Graph and immediately import data, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneCreateGraphWithImportOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_create_graph_with_import]
:end-before: [END howto_operator_neptune_analytics_create_graph_with_import]

.. _howto/operator:NeptuneStartImportTaskOperator:

Import data into an existing Neptune Graph
==========================================

To import data into an existing Neptune Analytics Graph, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneStartImportTaskOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_start_import_task]
:end-before: [END howto_operator_neptune_analytics_start_import_task]

.. _howto/operator:NeptuneCancelImportTaskOperator:

Cancel a running import task
============================

To cancel an existing import task, you can use
:class:`~airflow.providers.amazon.aws.operators.neptune_analytics.NeptuneCancelImportTaskOperator`.
This operator can be run in deferrable mode by passing ``deferrable=True`` as a parameter. This requires
the aiobotocore module to be installed.

.. exampleinclude:: /../../amazon/tests/system/amazon/aws/example_neptune_analytics.py
:language: python
:dedent: 4
:start-after: [START howto_operator_neptune_analytics_cancel_import_task]
:end-before: [END howto_operator_neptune_analytics_cancel_import_task]
13 changes: 13 additions & 0 deletions providers/amazon/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ integrations:
how-to-guide:
- /docs/apache-airflow-providers-amazon/operators/mwaa.rst
tags: [aws]
- integration-name: Amazon Neptune Analytics
external-doc-url: https://docs.aws.amazon.com/neptune-analytics/latest/userguide/gettingStarted.html
logo: /docs/integration-logos/Amazon-Neptune_64.png
how-to-guide:
- /docs/apache-airflow-providers-amazon/operators/neptune_analytics.rst
tags: [aws]
- integration-name: Amazon S3 Vectors
external-doc-url: https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-vectors.html
logo: /docs/integration-logos/Amazon-Simple-Storage-Service-S3_light-bg@4x.png
Expand Down Expand Up @@ -520,6 +526,7 @@ operators:
- integration-name: Amazon Neptune
python-modules:
- airflow.providers.amazon.aws.operators.neptune
- airflow.providers.amazon.aws.operators.neptune_analytics
- integration-name: Amazon S3 Vectors
python-modules:
- airflow.providers.amazon.aws.operators.s3_vectors
Expand Down Expand Up @@ -784,6 +791,8 @@ hooks:
- integration-name: Amazon Neptune
python-modules:
- airflow.providers.amazon.aws.hooks.neptune
- airflow.providers.amazon.aws.hooks.neptune_analytics


bundles:
- integration-name: Amazon Simple Storage Service (S3)
Expand Down Expand Up @@ -866,6 +875,7 @@ triggers:
- integration-name: Amazon Neptune
python-modules:
- airflow.providers.amazon.aws.triggers.neptune
- airflow.providers.amazon.aws.triggers.neptune_analytics
- integration-name: AWS Database Migration Service
python-modules:
- airflow.providers.amazon.aws.triggers.dms
Expand Down Expand Up @@ -981,6 +991,9 @@ extra-links:
- airflow.providers.amazon.aws.links.datasync.DataSyncTaskExecutionLink
- airflow.providers.amazon.aws.links.ec2.EC2InstanceLink
- airflow.providers.amazon.aws.links.ec2.EC2InstanceDashboardLink
- airflow.providers.amazon.aws.links.neptune_analytics.NeptuneGraphLink
- airflow.providers.amazon.aws.links.neptune_analytics.NeptuneImportTaskLink
- airflow.providers.amazon.aws.links.ec2.VpcEndpointLink

connection-types:
- hook-class-name: airflow.providers.amazon.aws.hooks.base_aws.AwsGenericHook
Expand Down
24 changes: 24 additions & 0 deletions providers/amazon/src/airflow/providers/amazon/aws/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,27 @@ def __reduce__(self):

class S3HookUriParseFailure(AirflowException):
"""When parse_s3_url fails to parse URL, this error is thrown."""


class NeptuneGraphCreationFailedError(AirflowException):
"""Raised when a Neptune Analytics graph fails to reach the available state."""


class NeptunePrivateEndpointCreationFailedError(AirflowException):
"""Raised when a Neptune Analytics private graph endpoint fails to be created."""


class NeptunePrivateEndpointDeletionFailedError(AirflowException):
"""Raised when a Neptune Analytics private graph endpoint fails to be deleted."""


class NeptuneGraphDeletionFailedError(AirflowException):
"""Raised when a Neptune Analytics graph deletion encounters an unexpected AWS error."""


class NeptuneImportTaskCancellationFailedError(AirflowException):
"""Raised when a Neptune Analytics import task cancellation fails or returns an unexpected status."""


class NeptuneImportTaskFailedError(AirflowException):
"""Raised when a Neptune Analytics import task fails to complete successfully."""
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# 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.

from __future__ import annotations

from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook


class NeptuneAnalyticsHook(AwsBaseHook):
"""
Interact with Amazon Neptune Analytics.

Additional arguments (such as ``aws_conn_id``) may be specified and
are passed down to the underlying AwsBaseHook.

.. seealso::
- :class:`~airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook`
"""

def __init__(self, *args, **kwargs):
kwargs["client_type"] = "neptune-graph"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

difference between neptune graph vs neptune analytics?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neptune analytics is how the service is identified in the AWS documentation. The boto3 service is neptune-graph, which causes confusion. I chose Neptune Analytics for all the operators since a customer is likely to use that name with searching.

super().__init__(*args, **kwargs)

def _get_graph_endpoint_id(self, graph_id: str, vpc_id: str):
"""Return the vpc endpoint id for this graph."""
result = self.conn.get_private_graph_endpoint(graphIdentifier=graph_id, vpcId=vpc_id)
return result.get("vpcEndpointId")
11 changes: 11 additions & 0 deletions providers/amazon/src/airflow/providers/amazon/aws/links/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,14 @@ class EC2InstanceDashboardLink(BaseAwsLink):
@staticmethod
def format_instance_id_filter(instance_ids: list[str]) -> str:
return ",:".join(instance_ids)


class VpcEndpointLink(BaseAwsLink):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this should be in vpc.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about this. I opted for ec2.py because all the VPC-related actions fall under the ec2 client. I'd probably search under VPC before I searched under ec2 if I were looking for this. What's the preference?

"""Helper class for constructing a VPC Endpoint link."""

name = "VPC Endpoint"
key = "_vpc_endpoint"
format_str = (
BASE_AWS_CONSOLE_LINK
+ "/vpcconsole/home?region={region_name}#EndpointDetails:vpcEndpointId={endpoint_id}"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.
from __future__ import annotations

from airflow.providers.amazon.aws.links.base_aws import BASE_AWS_CONSOLE_LINK, BaseAwsLink


class NeptuneGraphLink(BaseAwsLink):
"""Helper class for constructing an Amazon Neptune Analytics Graph Link."""

name = "Neptune Graph"
key = "_neptune_graph"
format_str = (
BASE_AWS_CONSOLE_LINK
+ "/neptune/home?region={region_name}#analytics-graph-details:id={graph_id}"
+ ";tab=connectivity"
)


class NeptuneImportTaskLink(BaseAwsLink):
"""Helper class for constructing an Amazon Neptune Analytics import task link."""

name = "Neptune Import Task"
key = "_import_task"
format_str = (
BASE_AWS_CONSOLE_LINK
+ "/neptune/home?region={region_name}#analytics-import-task-details:id={import_task_id}"
)
Loading
Loading