-
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
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. |
||
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. |
||
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,31 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
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. Python files should not be named with uppercase names. They should match the patterns in the rest of the library. Same for all files in this PR. |
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# snippet-start:[neptune.python.hello.main] | ||
import boto3 | ||
|
||
def describe_db_clusters(neptune_client): | ||
""" | ||
Describes the Amazon Neptune DB clusters synchronously using a single call. | ||
|
||
:param neptune_client: Boto3 Neptune client | ||
""" | ||
response = neptune_client.describe_db_clusters() | ||
for cluster in response.get("DBClusters", []): | ||
print(f"Cluster Identifier: {cluster['DBClusterIdentifier']}") | ||
print(f"Status: {cluster['Status']}") | ||
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. The specification requires handling a ResourceNotFoundException. |
||
|
||
|
||
def main(): | ||
""" | ||
Main entry point: creates the Neptune client and calls the describe operation. | ||
""" | ||
neptune_client = boto3.client("neptune", region_name="us-east-1") | ||
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. Do not hard-code regions. |
||
try: | ||
describe_db_clusters(neptune_client) | ||
except Exception as e: | ||
print(f"Error describing DB clusters: {str(e)}") | ||
|
||
if __name__ == "__main__": | ||
main() | ||
# snippet-end:[neptune.python.hello.main] |
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.