Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bb435c8
neptune analytics initial
Feb 4, 2026
a85224d
Added NeptuneCreateGraphOperator and supporting files/classes
Feb 19, 2026
5a96713
Added private endpoint operators
Mar 4, 2026
7cf5b6c
fixed assignment error
Mar 5, 2026
c70a3f6
Fixed type error
Mar 5, 2026
3f2a0a3
fixed another return type error
Mar 5, 2026
e37fbd6
Fixed assignment error in delete endpoint operator
Mar 5, 2026
0c35600
Added NeptuneDeleteGraphOperator and NeptuneStartImportTaskOperator
Mar 16, 2026
0e55791
Fixed prek findings
Mar 16, 2026
69f8fd8
Added NeptuneCancelImportTaskOperator
Mar 16, 2026
e0e6a44
Added system tests and fixed errors found during system testing
ellisms Mar 23, 2026
b879497
Added additional links for import job and vpce
ellisms Mar 24, 2026
d1ca1bf
Updated system and unit tests, and operator fixes
ellisms Mar 26, 2026
7685064
Added Neptune Analytics docs
ellisms Mar 26, 2026
1983d76
added console links to NeptuneCreateGraphWithImportOperator
ellisms Mar 26, 2026
7dfac96
Fixed missing operator_extra_links assignment
ellisms Mar 26, 2026
9ab4b3f
Update providers/amazon/tests/unit/amazon/aws/triggers/test_neptune_a…
ellisms Apr 6, 2026
947c123
Update providers/amazon/src/airflow/providers/amazon/aws/operators/ne…
ellisms Apr 6, 2026
972526c
Fixed issues found in CI
ellisms Apr 6, 2026
d44d026
Fixed broken test and CI failures
ellisms Apr 7, 2026
4207545
Fixed url typo in provider file
ellisms Apr 7, 2026
fa0a643
Requested PR changes
Apr 12, 2026
890bf7d
Added Neptune Analytics exceptions and addressed PR comments
Apr 25, 2026
e29b4f0
Fixed mypy errors
Apr 26, 2026
e54af79
provider update
May 2, 2026
155d462
Updated system test exception handling based on prek findings
May 2, 2026
f8c0890
Fixed calling lower() on None
May 2, 2026
d517ecd
Added custom import waiter and addressed PR suggestions
ellisms May 22, 2026
d6cb794
Addressed mypy finding
ellisms Jun 9, 2026
663ebad
Fixed deferrable issues found in testing
ellisms Jun 26, 2026
3b8b22c
Fixed function signature error
ellisms Jun 29, 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 @@ -312,6 +312,7 @@ ContainerPort
contentUrl
contextmgr
contrib
convertToIri
cooldown
copyable
CoreV
Expand Down Expand Up @@ -448,6 +449,7 @@ deidentify
DeidentifyTemplate
del
delim
deliverability
deltalake
denylist
dep
Expand Down Expand Up @@ -1013,6 +1015,7 @@ longblob
lookups
lshift
lxml
m-NCUs
machineTypes
macOS
mae
Expand Down Expand Up @@ -1101,6 +1104,7 @@ nat
natively
nav
navbar
NCUs
nd
ndjson
nearText
Expand Down Expand Up @@ -1130,9 +1134,11 @@ NotFound
notificationChannels
notin
npm
nquads
ns
ntlm
ntpd
ntriples
Nullable
nullable
num
Expand Down Expand Up @@ -1160,6 +1166,7 @@ Oozie
OpenAI
openai
openapi
opencypher
openfaas
OpenID
openjdk
Expand Down Expand Up @@ -1359,6 +1366,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 thread
ellisms marked this conversation as resolved.
.. 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 @@ -404,6 +404,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 @@ -525,6 +531,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 @@ -789,6 +796,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 @@ -871,6 +880,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 @@ -986,6 +996,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 @@ -54,3 +54,27 @@ class S3HookUriParseFailure(AirflowException):

class S3HookPathTraversalError(AirflowException):
"""Raise when an S3 object key resolves outside the target local directory."""


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"
Comment thread
eladkal marked this conversation as resolved.
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):
Comment thread
o-nikolas marked this conversation as resolved.
"""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