Skip to content

Commit

Permalink
default to no pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen15 committed Dec 6, 2024
1 parent f59a7e6 commit 63e7511
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
21 changes: 12 additions & 9 deletions graphiti_core/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand All @@ -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,
Expand Down Expand Up @@ -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(
"""
Expand All @@ -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,
Expand Down Expand Up @@ -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(
"""
Expand All @@ -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,
Expand Down
21 changes: 12 additions & 9 deletions graphiti_core/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand All @@ -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,
Expand Down Expand Up @@ -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(
"""
Expand All @@ -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,
Expand Down Expand Up @@ -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(
"""
Expand All @@ -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,
Expand Down

0 comments on commit 63e7511

Please sign in to comment.