Skip to content

Conversation

@katarinasupe
Copy link
Contributor

@katarinasupe katarinasupe commented May 14, 2025

Description

  • The Index class is immutable, requiring an immutable type for a property. This means that a tuple must be used instead of a list. Hence, the list returned from Memgraph will be converted to a tuple post initialization so it can be properly handled. From the user perspective, they can define property in the label-property index with a tuple or a list - both should work as expected. If the label property index is not composite, a simple string for the property should work as expected as well. These changes are handled in the Index and MemgraphIndex classes in models.py.
  • Added the differentiation between different types of indexes (_convert_index_type procedure in memgraph.py), based on different Cypher queries used for their creation and deletion - LABEL (default, used for label and label+property index types, including composite indexes), EDGE (used for edge-type and edge-type+property), EDGE_GLOBAL (used for edge-property) and POINT (used for point index). By doing that, get_indexes, ensure_indexes, drop_indexes from the memgraph.py and drop_index and create_index procedures from the database_client.py should be working as expected (and drop_index and create_index became abstract, as the changes are Memgraph-related). The to_cypher procedure from the Index class was affected by this change as well. Since this change is Memgraph-related, to_cypher became abstract.
  • Vector index is not included in these changes, as it's not included from the Memgraph perspective (SHOW INDEX INFO query).
  • Added multiple tests to showcase how to create, drop, get and ensure all index types and to check that all works as expected.
  • Docs are updated with examples for all index types.

Pull request type

Please delete options that are not relevant.

  • Bugfix - order of indexes returned from database is irrelevant
  • Feature - new index types
  • Documentation content changes - TODO

Related issues

Closes #348

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

######################################

Reviewer checklist (the reviewer checks this part)

  • Core feature implementation
  • Tests
  • Code documentation
  • Documentation on gqlalchemy/docs

######################################

@katarinasupe katarinasupe added this to the GQLAlchemy 1.8.0 milestone May 14, 2025
@katarinasupe katarinasupe requested a review from antejavor May 15, 2025 12:28
Copy link
Contributor

@antejavor antejavor left a comment

Choose a reason for hiding this comment

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

LGTM, there are a few comments you can consider but mostly cosmetic in nature.

@katarinasupe katarinasupe merged commit 1c45801 into main May 16, 2025
6 checks passed
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.

Compatibility change due to Memgraph now supporting composite indices

3 participants