-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
base: main
Are you sure you want to change the base?
Changes from all commits
cfffdd3
67b8e9e
2c28b21
1003c0e
9d8fbae
9602110
61d4de2
281c96d
194a234
97bd8b8
43f9145
3c971ff
d2e8089
2b3de9e
a8c9e2d
049ae7b
0e6e9dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -31,6 +47,14 @@ neptune_ExecuteQuery: | |
neptune: {ExecuteQuery} | ||
neptune_CreateGraph: | ||
languages: | ||
Python: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metadata key not listed in specification. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -44,6 +68,14 @@ neptune_CreateGraph: | |
neptune: {CreateGraph} | ||
neptune_ExecuteOpenCypherExplainQuery: | ||
languages: | ||
Python: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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..