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

Query function rework #91

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

m-appel
Copy link
Member

@m-appel m-appel commented Dec 17, 2023

This PR reworks the main functions used to query/create nodes. Both get_node and batch_get_nodes functions now have a similar interface and behavior.
Added support for multi-label nodes.

  • batch_get_nodes_by_single_prop
    • Renamed from batch_get_nodes
    • Added create parameter for consistency
  • get_node
    • Change default value of create parameter to True. There was no instance where this function was called with create=False and now it is consistent with batch_get_nodes.
    • Change interface to be the same as batch_get_nodes.
    • Id properties used as the search predicate must now be specified explicitly instead of being inferred from constraints.
  • batch_get_nodes
    • New function that supports querying/creating nodes with multiple properties, where as subset of the properties can be used as the search predicate.
  • batch_add_node_label
    • New function to add additional labels to existing nodes.
  • batch_create_nodes
    • Deleted due to inflexibility and danger of creating duplicate nodes.

This PR reworks the main functions used to query/create nodes.
Both get_node and batch_get_nodes functions now have a similar interface
and behavior.
Added support for multi-label nodes.

- batch_get_nodes_by_single_prop
  - Renamed from batch_get_nodes
  - Added create parameter for consistency
- get_node
  - Change default value of create parameter to True. There was no
    instance where this function was called with create=False and now it
    is consistent with batch_get_nodes.
  - Change interface to be the same as batch_get_nodes.
  - Id properties used as the search predicate must now be specified
    explicitly instead of being inferred from constraints.
- batch_get_nodes
  - New function that supports querying/creating nodes with multiple
    properties, where as subset of the properties can be used as the
    search predicate.
- batch_add_node_label
  - New function to add additional labels to existing nodes.
- batch_create_nodes
  - Deleted due to inflexibility and danger of creating duplicate nodes.
Remove explicit constraints and indexes since these would need manual
updates every time we add a new node or relationship type.
Instead, we now automatically create UNIQUE constraints based on the id
properties used to create nodes. The rationale is that we (at least in
the context of crawlers) always get nodes based on unique properties. If
there are conflicts introduced by this is should only reveal problems in
our existing code.

Similarly, we now also create an index on the reference_name field of
all relationship types automatically, since this is used very often and
exists for all relationship types.
@romain-fontugne
Copy link
Member

I tried and it seemed to have worked as expected. thanks!

@romain-fontugne
Copy link
Member

ah, I think the version I tried didn't have the constrains and indexes. I'll try again before merging

@romain-fontugne
Copy link
Member

Looks good to me, thanks!

@romain-fontugne romain-fontugne merged commit ed0180b into InternetHealthReport:main Dec 19, 2023
2 checks passed
@m-appel m-appel deleted the query-rework branch December 19, 2023 07:40
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