Skip to content
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

Added compatibility with Neptune Analytics #241

Merged
merged 19 commits into from
Mar 2, 2024

Conversation

vkagamlyk
Copy link
Contributor

Issue #, if available:

Description of changes:
Added option to connect to Neptune Analytics

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

Copy link

codecov bot commented Feb 21, 2024

Codecov Report

Attention: Patch coverage is 9.83607% with 55 lines in your changes are missing coverage. Please review.

Project coverage is 10.06%. Comparing base (372bb59) to head (200a1a9).
Report is 1 commits behind head on main.

Files Patch % Lines
.../src/modules/CreateConnection/CreateConnection.tsx 0.00% 49 Missing ⚠️
...ackages/graph-explorer/src/connector/useGEFetch.ts 0.00% 2 Missing ⚠️
.../src/modules/ConnectionDetail/ConnectionDetail.tsx 0.00% 2 Missing ⚠️
...er/src/connector/openCypher/queries/fetchSchema.ts 0.00% 1 Missing ⚠️
...explorer/src/connector/openCypher/useOpenCypher.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #241   +/-   ##
=======================================
  Coverage   10.06%   10.06%           
=======================================
  Files         408      409    +1     
  Lines       30114    30150   +36     
  Branches      660      660           
=======================================
+ Hits         3030     3036    +6     
- Misses      26749    26779   +30     
  Partials      335      335           
Flag Coverage Δ
unittests 10.06% <9.83%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -49,6 +49,7 @@ You can create and manage connections to graph databases using this feature. Con
- **Using proxy server:** Check this box if using a proxy endpoint.
- **Graph connection URL:** Provide the endpoint for the graph database
- **AWS IAM Auth Enabled:** Check this box if connecting to Amazon Neptune using IAM Auth and SigV4 signed requests
- **Service Type:** Choose the service type
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's explain inline (so it is easier for folks to understand) - choose service time neptune-db for Neptune database, neptune-graph for Neptune Analytics or empty when not using IAM authentication. ?

@@ -133,6 +135,7 @@ First, create a `config.json` file containing values for the connection attribut
"GRAPH_CONNECTION_URL": "https://cluster-cqmizgqgrsbf.us-west-2.neptune.amazonaws.com:8182",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"GRAPH_CONNECTION_URL": "https://cluster-cqmizgqgrsbf.us-west-2.neptune.amazonaws.com:8182",
"GRAPH_CONNECTION_URL": "https://cluster-somecluster.us-west-2.neptune.amazonaws.com:8182",

@@ -160,6 +163,7 @@ docker run -p 80:80 -p 443:443 \
--env IAM=false \
--env GRAPH_CONNECTION_URL=https://cluster-cqmizgqgrsbf.us-west-2.neptune.amazonaws.com:8182 \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--env GRAPH_CONNECTION_URL=https://cluster-cqmizgqgrsbf.us-west-2.neptune.amazonaws.com:8182 \
--env GRAPH_CONNECTION_URL=https://cluster-somecluster.us-west-2.neptune.amazonaws.com:8182 \

Exact endpoints should not be used in the documentation.

@@ -79,6 +79,7 @@ const fetchVerticesAttributes = async (
const response = await openCypherFetch<RawVerticesSchemaResponse>(verticesTemplate);

const vertex = response.results[0]?.object as OCVertex;
if (!vertex) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: avoid adding a return statement, and wrap vertices.push({ within the condition, to avoid fragmented logic with multiple returns.

Suggested change
if (!vertex) return;
if (vertex) {
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's return early pattern

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @vkagamlyk in this case. Returning early when checking assertions is good practice.

The only nit I would have is to not use inline if statements. While it is more code, it is also more readable. It's much easier to find the places in a method that return early if the return call is in a predictable place. Having it inline makes the placement depend on the condition expression length.

if (!vertex) {
  return;
}

Co-authored-by: Alexey Temnikov <alexey.temnikov@improving.com>
michaelnchin
michaelnchin previously approved these changes Feb 24, 2024
Copy link
Member

@michaelnchin michaelnchin left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@michaelnchin michaelnchin left a comment

Choose a reason for hiding this comment

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

General request - if neptune-graph service is specified as part of default connection arguments during Docker run, only the PG-openCypher connection profile should be accessible; the PG-Gremlin and SPARQL profiles should not be created.

packages/graph-explorer-proxy-server/node-server.js Outdated Show resolved Hide resolved
Copy link
Member

@michaelnchin michaelnchin left a comment

Choose a reason for hiding this comment

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

Validated Connection + Graph UI functionality on the SageMaker-hosted app. Default connections require additional changes, but I will consider that outside the scope of this PR. Thanks @vkagamlyk !

@michaelnchin michaelnchin merged commit 4afffee into aws:main Mar 2, 2024
2 of 3 checks passed
@kmcginnes kmcginnes deleted the neptune-graph branch March 19, 2024 15:37
@kmcginnes
Copy link
Collaborator

Validated Connection + Graph UI functionality on the SageMaker-hosted app. Default connections require additional changes, but I will consider that outside the scope of this PR. Thanks @vkagamlyk !

This was covered in PR #254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants