diff --git a/graphiti_core/edges.py b/graphiti_core/edges.py index 8e122278..936f04d7 100644 --- a/graphiti_core/edges.py +++ b/graphiti_core/edges.py @@ -142,10 +142,11 @@ async def get_by_group_ids( cls, driver: AsyncDriver, group_ids: list[str], - limit: int = DEFAULT_PAGE_LIMIT, + limit: int | None = None, created_at: datetime | None = None, ): cursor_query: LiteralString = 'AND e.created_at < $created_at' if created_at else '' + limit_query: LiteralString = 'LIMIT $limit' if limit is not None else '' records, _, _ = await driver.execute_query( """ @@ -161,8 +162,8 @@ async def get_by_group_ids( m.uuid AS target_node_uuid, e.created_at AS created_at ORDER BY e.uuid DESC - LIMIT $limit - """, + """ + + limit_query, group_ids=group_ids, created_at=created_at, limit=limit, @@ -294,10 +295,11 @@ async def get_by_group_ids( cls, driver: AsyncDriver, group_ids: list[str], - limit: int = DEFAULT_PAGE_LIMIT, + limit: int | None = None, created_at: datetime | None = None, ): cursor_query: LiteralString = 'AND e.created_at < $created_at' if created_at else '' + limit_query: LiteralString = 'LIMIT $limit' if limit is not None else '' records, _, _ = await driver.execute_query( """ @@ -320,8 +322,8 @@ async def get_by_group_ids( e.valid_at AS valid_at, e.invalid_at AS invalid_at ORDER BY e.uuid DESC - LIMIT $limit - """, + """ + + limit_query, group_ids=group_ids, created_at=created_at, limit=limit, @@ -400,10 +402,11 @@ async def get_by_group_ids( cls, driver: AsyncDriver, group_ids: list[str], - limit: int = DEFAULT_PAGE_LIMIT, + limit: int | None = None, created_at: datetime | None = None, ): cursor_query: LiteralString = 'AND e.created_at < $created_at' if created_at else '' + limit_query: LiteralString = 'LIMIT $limit' if limit is not None else '' records, _, _ = await driver.execute_query( """ @@ -419,8 +422,8 @@ async def get_by_group_ids( m.uuid AS target_node_uuid, e.created_at AS created_at ORDER BY e.uuid DESC - LIMIT $limit - """, + """ + + limit_query, group_ids=group_ids, created_at=created_at, limit=limit, diff --git a/graphiti_core/nodes.py b/graphiti_core/nodes.py index eb650c8e..9ef7a967 100644 --- a/graphiti_core/nodes.py +++ b/graphiti_core/nodes.py @@ -212,10 +212,11 @@ async def get_by_group_ids( cls, driver: AsyncDriver, group_ids: list[str], - limit: int = DEFAULT_PAGE_LIMIT, + limit: int | None = None, created_at: datetime | None = None, ): cursor_query: LiteralString = 'AND e.created_at < $created_at' if created_at else '' + limit_query: LiteralString = 'LIMIT $limit' if limit is not None else '' records, _, _ = await driver.execute_query( """ @@ -233,8 +234,8 @@ async def get_by_group_ids( e.source_description AS source_description, e.source AS source ORDER BY e.uuid DESC - LIMIT $limit - """, + """ + + limit_query, group_ids=group_ids, created_at=created_at, limit=limit, @@ -328,10 +329,11 @@ async def get_by_group_ids( cls, driver: AsyncDriver, group_ids: list[str], - limit: int = DEFAULT_PAGE_LIMIT, + limit: int | None = None, created_at: datetime | None = None, ): cursor_query: LiteralString = 'AND n.created_at < $created_at' if created_at else '' + limit_query: LiteralString = 'LIMIT $limit' if limit is not None else '' records, _, _ = await driver.execute_query( """ @@ -347,8 +349,8 @@ async def get_by_group_ids( n.created_at AS created_at, n.summary AS summary ORDER BY n.uuid DESC - LIMIT $limit - """, + """ + + limit_query, group_ids=group_ids, created_at=created_at, limit=limit, @@ -442,10 +444,11 @@ async def get_by_group_ids( cls, driver: AsyncDriver, group_ids: list[str], - limit: int = DEFAULT_PAGE_LIMIT, + limit: int | None = None, created_at: datetime | None = None, ): cursor_query: LiteralString = 'AND n.created_at < $created_at' if created_at else '' + limit_query: LiteralString = 'LIMIT $limit' if limit is not None else '' records, _, _ = await driver.execute_query( """ @@ -461,8 +464,8 @@ async def get_by_group_ids( n.created_at AS created_at, n.summary AS summary ORDER BY n.uuid DESC - LIMIT $limit - """, + """ + + limit_query, group_ids=group_ids, created_at=created_at, limit=limit,