Skip to content

upsert_vectors() shouldn't use element IDs? #385

@Herakleis

Description

@Herakleis

It seems that using elementIds is not safe outside the scope of a single transaction as per the official Neo4j documentation.

upsert_vectors() expects an ids list which is then injected into a Cypher query depending on the entity_type targeted, for example here for nodes.

Requiring the ids to be the element IDs means they need to be retrieved in a different session than the one started within upsert_vectors() from the .execute_query() call here, which contradicts the official recommendation as those IDs can't be considered stable across sessions/transactions.

Suggested changes:

  • support passing a user-created ID to upsert_vectors() instead (e.g. a UUID property on nodes/relationships)
  • and/or support elementId matching in scope of the same session/transaction as underlying upsert query

Let me know if I'm missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions