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

GraphQL mutation apis #1719

Merged
merged 13 commits into from
Aug 23, 2024
Merged

GraphQL mutation apis #1719

merged 13 commits into from
Aug 23, 2024

Conversation

ljeub-pometry
Copy link
Collaborator

@ljeub-pometry ljeub-pometry commented Aug 21, 2024

What changes were proposed in this pull request?

Add support for creating and mutating graphs using GraphQL

Graph Functions

  • graph.add_node()
  • graph.add_edge()
  • graph.delete_edge()
  • graph.add_properties()
  • graph.add_constant_properties()
  • graph.window.subgraph.etc.export_to("path/for/other/graph/")

Node functions

  • graph.node.add_updates()
  • graph.node.add_constant_properties()
  • graph.node.update_constant_properties()

Edge functions

  • graph.edge.add_updates()
  • graph.edge.delete()
  • graph.edge.add_constant_properties()
  • graph.edge.update_constant_properties()

Why are the changes needed?

Does this PR introduce any user-facing change? If yes is this documented?

How was this patch tested?

Issues

If this resolves any issues, please link to them here, the format is a KEYWORD followed by @_
KEYWORDS available are close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved.
Please delete this text before creating your PR

Are there any further changes required?

@ljeub-pometry ljeub-pometry force-pushed the feature/GraphQl-mutations branch from efd304e to 8056113 Compare August 21, 2024 15:27
github-actions[bot]

This comment was marked as resolved.

@miratepuffin
Copy link
Collaborator

miratepuffin commented Aug 22, 2024

Random stuff I have found

  • If there is an invalid graph/file within your working directory on startup the sever won't start - perhaps should just skip the file and log a warning
  • new_graph function gives "IO operation failed" when graph already exists - should be 'Graph already exists'
  • new_graph function currently doesn't handle parent dirs correctly.
  • If we delete all graphs in a namespace, do we want to also delete the namespace?
  • When creating a new RaphtoryClient, it doesn't check the given URL, meaning an error is only thrown when you run your first query
  • props needs to be properties to keep it inline with the python apis
  • props in bulk updates need to be optional
  • "Field "addNode" of type "GqlMutableNode" must have a selection of subfields"

@ljeub-pometry
Copy link
Collaborator Author

[ ] "Field "addNode" of type "GqlMutableNode" must have a selection of subfields"

that is just how GraphQL works

@miratepuffin miratepuffin marked this pull request as ready for review August 23, 2024 12:25
Copy link
Collaborator

@miratepuffin miratepuffin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator Author

@ljeub-pometry ljeub-pometry left a comment

Choose a reason for hiding this comment

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

Note that the nicer error message check is not atomic. There is still a small chance of getting the IO error instead.

return Err(GraphError::GraphNameAlreadyExists(path.to_path_buf()).into());
}
create_dirs_if_not_present(&full_path)?;
let mut cache = File::create_new(full_path)?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this can still fail with the mysterious IO error here if someone manages to create the file between the previous check and this one. Probably better to only use this to check and map the error for a better message.

@miratepuffin miratepuffin merged commit 3a203cb into master Aug 23, 2024
19 checks passed
@miratepuffin miratepuffin deleted the feature/GraphQl-mutations branch August 23, 2024 13:09
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.

2 participants