Skip to content

Python Add the Amazon Neptune Python follow #7473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d11c60e
add python neptune follow
scmacdon Jun 5, 2025
0cf2601
added Hello Neptune
scmacdon Jun 5, 2025
9a2d5ed
added Hello Neptune
scmacdon Jun 5, 2025
cf149c4
added data Neptune examples
scmacdon Jun 5, 2025
e904004
added data Neptune examples
scmacdon Jun 6, 2025
3ae7cb4
added python to SOS
scmacdon Jun 6, 2025
43b598d
added python to SOS
scmacdon Jun 6, 2025
2cc5ac2
added python to SOS
scmacdon Jun 6, 2025
500e56b
added python to SOS
scmacdon Jun 6, 2025
09ed0a6
added Readme
scmacdon Jun 6, 2025
88a8922
added Readme
scmacdon Jun 6, 2025
748e48e
rolled in review comments
scmacdon Jun 11, 2025
d42cc93
rolled in review comments
scmacdon Jun 12, 2025
6fc1e4b
rolled in review comments
scmacdon Jun 12, 2025
09e6c63
rolled in review comments
scmacdon Jun 13, 2025
685bf20
rolled in review comments
scmacdon Jun 13, 2025
b59040b
rolled in reivew comments
scmacdon Jun 17, 2025
7323206
rolled in reivew comments
scmacdon Jun 17, 2025
e297b85
rolled in more comments
scmacdon Jun 18, 2025
d2fe7b1
fixed tag
scmacdon Jun 18, 2025
7e35908
more review comments
scmacdon Jun 18, 2025
0203ece
more review comments
scmacdon Jun 18, 2025
5060101
more review comments
scmacdon Jun 18, 2025
0991f9b
makde updates to exceptions and tests
scmacdon Jun 24, 2025
b983e70
update some tests
scmacdon Jun 25, 2025
4ee3b76
moved stubber to propet location
scmacdon Jun 25, 2025
363c46b
fixed a liner issue
scmacdon Jun 25, 2025
bd4bb1c
fixed a liner issue
scmacdon Jun 25, 2025
833c6ae
fixed a liner issue
scmacdon Jun 25, 2025
74e6631
fixed a liner issue
scmacdon Jun 25, 2025
25d24dd
added requirements file
scmacdon Jun 25, 2025
77d70f7
updated scenario
scmacdon Jun 25, 2025
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
136 changes: 136 additions & 0 deletions .doc_gen/metadata/neptune_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ neptune_Hello:
synopsis: get started using &neptune;.
category: Hello
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.hello.main
Java:
versions:
- sdk_version: 2
Expand All @@ -18,6 +26,14 @@ neptune_Hello:
neptune: {DescribeDBClustersPaginator}
neptune_ExecuteQuery:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.graph.execute.main
Java:
versions:
- sdk_version: 2
Expand All @@ -31,6 +47,14 @@ neptune_ExecuteQuery:
neptune: {ExecuteQuery}
neptune_CreateGraph:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.graph.create.main
Java:
versions:
- sdk_version: 2
Expand All @@ -44,6 +68,14 @@ neptune_CreateGraph:
neptune: {CreateGraph}
neptune_ExecuteOpenCypherExplainQuery:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.data.query.opencypher.main
Java:
versions:
- sdk_version: 2
Expand All @@ -57,6 +89,14 @@ neptune_ExecuteOpenCypherExplainQuery:
neptune: {ExecuteOpenCypherExplainQuery}
neptune_ExecuteGremlinProfileQuery:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.data.query.gremlin.main
Java:
versions:
- sdk_version: 2
Expand All @@ -70,6 +110,14 @@ neptune_ExecuteGremlinProfileQuery:
neptune: {ExecuteGremlinProfileQuery}
neptune_ExecuteGremlinQuery:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.data.query.gremlin.profile.main
Java:
versions:
- sdk_version: 2
Expand All @@ -83,6 +131,14 @@ neptune_ExecuteGremlinQuery:
neptune: {ExecuteGremlinQuery}
neptune_DeleteDBSubnetGroup:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.delete.subnet.group.main
Java:
versions:
- sdk_version: 2
Expand All @@ -96,6 +152,14 @@ neptune_DeleteDBSubnetGroup:
neptune: {DeleteDBSubnetGroup}
neptune_DeleteDBCluster:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.delete.cluster.main
Java:
versions:
- sdk_version: 2
Expand All @@ -109,6 +173,14 @@ neptune_DeleteDBCluster:
neptune: {DeleteDBCluster}
neptune_DeleteDBInstance:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.delete.instance.main
Java:
versions:
- sdk_version: 2
Expand All @@ -122,6 +194,14 @@ neptune_DeleteDBInstance:
neptune: {DeleteDBInstance}
neptune_StartDBCluster:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.start.cluster.main
Java:
versions:
- sdk_version: 2
Expand All @@ -135,6 +215,14 @@ neptune_StartDBCluster:
neptune: {StartDBCluster}
neptune_StopDBCluster:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.stop.cluster.main
Java:
versions:
- sdk_version: 2
Expand All @@ -148,6 +236,14 @@ neptune_StopDBCluster:
neptune: {StopDBCluster}
neptune_DescribeDBClusters:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.describe.cluster.main
Java:
versions:
- sdk_version: 2
Expand All @@ -161,6 +257,14 @@ neptune_DescribeDBClusters:
neptune: {DescribeDBClusters}
neptune_DescribeDBInstances:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.describe.dbinstance.main
Java:
versions:
- sdk_version: 2
Expand All @@ -174,6 +278,14 @@ neptune_DescribeDBInstances:
neptune: {DescribeDBInstances}
neptune_CreateDBInstance:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.create.dbinstance.main
Java:
versions:
- sdk_version: 2
Expand All @@ -187,6 +299,14 @@ neptune_CreateDBInstance:
neptune: {CreateDBInstance}
neptune_CreateDBCluster:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.create.cluster.main
Java:
versions:
- sdk_version: 2
Expand All @@ -200,6 +320,14 @@ neptune_CreateDBCluster:
neptune: {CreateDBCluster}
neptune_CreateDBSubnetGroup:
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.create.subnet.main
Java:
versions:
- sdk_version: 2
Expand All @@ -223,6 +351,14 @@ neptune_Scenario:
- Delete the &neptune; Assets.
category: Basics
languages:
Python:
versions:
- sdk_version: 3
github: python/example_code/neptune
excerpts:
- description:
snippet_tags:
- neptune.python.scenario.main
Java:
versions:
- sdk_version: 2
Expand Down
142 changes: 142 additions & 0 deletions python/example_code/neptune/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Neptune code examples for the SDK for Python

## Overview

Shows how to use the AWS SDK for Python (Boto3) to work with Amazon Neptune.

<!--custom.overview.start-->
<!--custom.overview.end-->

_Neptune is a serverless graph database designed for superior scalability and availability._

## ⚠ Important

* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
* Running the tests might result in charges to your AWS account.
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).

<!--custom.important.start-->
<!--custom.important.end-->

## Code examples

### Prerequisites

For prerequisites, see the [README](../../README.md#Prerequisites) in the `python` folder.

Install the packages required by these examples by running the following in a virtual environment:

```
python -m pip install -r requirements.txt
```

<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->

### Get started

- [Hello Neptune](HelloNeptune.py#L4) (`DescribeDBClustersPaginator`)


### Basics

Code examples that show you how to perform the essential operations within a service.

- [Learn the basics](NeptuneScenario.py)


### Single actions

Code excerpts that show you how to call individual service functions.

- [CreateDBCluster](NeptuneScenario.py#L288)
- [CreateDBInstance](NeptuneScenario.py#L269)
- [CreateDBSubnetGroup](NeptuneScenario.py#L335)
- [CreateGraph](analytics/CreateNeptuneGraphExample.py#L7)
- [DeleteDBCluster](NeptuneScenario.py#L14)
- [DeleteDBInstance](NeptuneScenario.py#L77)
- [DeleteDBSubnetGroup](NeptuneScenario.py#L95)
- [DescribeDBClusters](NeptuneScenario.py#L203)
- [DescribeDBInstances](NeptuneScenario.py#L242)
- [ExecuteGremlinProfileQuery](database/NeptuneGremlinQueryExample.py#L22)
- [ExecuteGremlinQuery](database/NeptuneGremlinExplainAndProfileExample.py#L8)
- [ExecuteOpenCypherExplainQuery](database/OpenCypherExplainExample.py#L22)
- [ExecuteQuery](analytics/NeptuneAnalyticsQueryExample.py#L7)
- [StartDBCluster](NeptuneScenario.py#L161)
- [StopDBCluster](NeptuneScenario.py#L183)


<!--custom.examples.start-->
<!--custom.examples.end-->

## Run the examples

### Instructions


<!--custom.instructions.start-->
<!--custom.instructions.end-->

#### Hello Neptune

This example shows you how to get started using Neptune.

```
python HelloNeptune.py
```

#### Learn the basics

This example shows you how to do the following:

- Create an Amazon Neptune Subnet Group.
- Create an Neptune Cluster.
- Create an Neptune Instance.
- Check the status of the Neptune Instance.
- Show Neptune cluster details.
- Stop the Neptune cluster.
- Start the Neptune cluster.
- Delete the Neptune Assets.

<!--custom.basic_prereqs.neptune_Scenario.start-->
<!--custom.basic_prereqs.neptune_Scenario.end-->

Start the example by running the following at a command prompt:

```
python NeptuneScenario.py
```


<!--custom.basics.neptune_Scenario.start-->
<!--custom.basics.neptune_Scenario.end-->


### Tests

⚠ Running tests might result in charges to your AWS account.


To find instructions for running these tests, see the [README](../../README.md#Tests)
in the `python` folder.



<!--custom.tests.start-->
<!--custom.tests.end-->

## Additional resources

- [Neptune User Guide](https://docs.aws.amazon.com/neptune/latest/userguide/intro.html)
- [Neptune API Reference](https://docs.aws.amazon.com/neptune/latest/apiref/Welcome.html)
- [SDK for Python Neptune reference](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html)

<!--custom.resources.start-->
<!--custom.resources.end-->

---

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
Loading
Loading