fix: route FalkorDB queries to correct graph for single group_id#1326
Open
spencer2211 wants to merge 1 commit intogetzep:mainfrom
Open
fix: route FalkorDB queries to correct graph for single group_id#1326spencer2211 wants to merge 1 commit intogetzep:mainfrom
spencer2211 wants to merge 1 commit intogetzep:mainfrom
Conversation
The handle_multiple_group_ids decorator only switched the FalkorDB driver to the correct graph database when len(group_ids) > 1. For a single group_id (the most common case), queries fell through to the default execution path, hitting 'default_db' which typically has no data. Additionally, all get_by_group_ids classmethods on node and edge types (EpisodicNode, EntityNode, CommunityNode, SagaNode, EpisodicEdge, EntityEdge, CommunityEdge, HasEpisodeEdge, NextEpisodeEdge) queried the driver directly without routing through the correct FalkorDB graph database. Since FalkorDB uses separate graph databases per group_id (unlike Neo4j which filters by group_id as a node property), these queries always hit whatever graph the driver was pointed at. Changes: - decorators.py: Change len(group_ids) > 1 to >= 1 - nodes.py: Add FalkorDB graph routing to all 4 get_by_group_ids methods - edges.py: Add FalkorDB graph routing to all 5 get_by_group_ids methods For single group_id: clone driver to target the group's graph, then fall through to the existing query logic. For multiple group_ids: query each graph separately, merge and re-sort results, apply limit.
Member
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
danielchalef
added a commit
that referenced
this pull request
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1325
Summary
The
handle_multiple_group_idsdecorator only switched the FalkorDB driver to the correct graph database whenlen(group_ids) > 1. For a singlegroup_id(the most common case), queries fell through to the default execution path, hittingdefault_dbwhich typically has no data. This caused silent empty results for all FalkorDB deployments using per-query group_ids.Additionally, all
get_by_group_idsclassmethods on node and edge types bypassed the decorator entirely, querying the driver directly without routing to the correct FalkorDB graph.Changes
decorators.pylen(group_ids) > 1tolen(group_ids) >= 1so the decorator activates for any non-empty group_ids listnodes.py(4 methods)EpisodicNode.get_by_group_ids,EntityNode.get_by_group_ids,CommunityNode.get_by_group_ids,SagaNode.get_by_group_idsedges.py(5 methods)EpisodicEdge.get_by_group_ids,EntityEdge.get_by_group_ids,CommunityEdge.get_by_group_ids,HasEpisodeEdge.get_by_group_ids,NextEpisodeEdge.get_by_group_idsApproach
For each
get_by_group_idsmethod:driver.clone(database=group_ids[0])), then fall through to the existing query logicThis approach avoids code duplication — the single-group case reuses the existing query path, and the multi-group case decomposes cleanly into single-group calls.
Context
FalkorDB uses separate graph databases per
group_id, unlike Neo4j which stores all data in a single database and filters bygroup_idas a node/edge property. The decorator and classmethods need to explicitly switch the driver to the correct graph database before executing queries.Discovered and verified against a production FalkorDB deployment running graphiti-core with the graphiti MCP server.