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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
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:
Copy link
Contributor

Choose a reason for hiding this comment

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

This metadata tag is not listed in the specification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a new section in the spec to include the code submitted from the SME. Its clear now in the spec..

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

Metadata key not listed in specification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See previous comment. SME contributed code that is outside the main scenario is now listed in spec.

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

Key not listed in specification. Same for many of these in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed - SME code now in spec.

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