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 15 commits into
base: main
Choose a base branch
from

Conversation

scmacdon
Copy link
Contributor

@scmacdon scmacdon commented Jun 5, 2025

This pull request adds the Amazon Neptune Python follow


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@scmacdon scmacdon self-assigned this Jun 5, 2025
@scmacdon scmacdon added Python This issue relates to the AWS SDK for Python (boto3) Basics A basic code example showing the core actions for a particular service. labels Jun 5, 2025
@scmacdon scmacdon added the Follow After Scouts, more languages are added to examples as Follows. label Jun 6, 2025
@scmacdon scmacdon requested a review from beqqrry-aws June 6, 2025 19:59
@scmacdon scmacdon added the On Call Review needed This work needs an on-call review label Jun 10, 2025
Copy link
Contributor

@rlhagerm rlhagerm left a comment

Choose a reason for hiding this comment

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

Once you've made the high-level fixes and it matches the specification, I can do a full review.

@@ -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.

@@ -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.

@@ -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.

@@ -0,0 +1,31 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

response = neptune_client.describe_db_clusters()
for cluster in response.get("DBClusters", []):
print(f"Cluster Identifier: {cluster['DBClusterIdentifier']}")
print(f"Status: {cluster['Status']}")
Copy link
Contributor

Choose a reason for hiding this comment

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

The specification requires handling a ResourceNotFoundException.

"""
Main entry point: creates the Neptune client and calls the describe operation.
"""
neptune_client = boto3.client("neptune", region_name="us-east-1")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not hard-code regions.

neptune_client.delete_db_cluster(**request)
print(f" Deleting DB Cluster: {cluster_id}")
except Exception as e:
print(f" Failed to delete DB Cluster '{cluster_id}': {e}")
Copy link
Contributor

Choose a reason for hiding this comment

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

The specification requires handling a ResourceNotFoundException. Same for all actions in this PR, they should follow the specification.

hours, mins = divmod(mins, 60)
return f"{hours:02}:{mins:02}:{secs:02}"

def wait_until_instance_deleted(
Copy link
Contributor

Choose a reason for hiding this comment

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

This section is not needed, it should use the built-in boto3 waiters.

@pytest.mark.integration
def test_neptune_run_scenario(monkeypatch):
# Patch input() to simulate all required inputs
input_sequence = iter([
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need to press c to move on in python.

@pytest.fixture(scope="module")
def neptune_client():
"""Create a real Neptune boto3 client for integration testing."""
client = boto3.client("neptune", region_name="us-east-1")
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's follow the current testing patterns in the library until we decide as a team to change it.

@rlhagerm rlhagerm removed the On Call Review needed This work needs an on-call review label Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Basics A basic code example showing the core actions for a particular service. Follow After Scouts, more languages are added to examples as Follows. Python This issue relates to the AWS SDK for Python (boto3)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants