Skip to content

Commit

Permalink
fix constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen15 committed Aug 22, 2024
1 parent 8a55f48 commit 4c09e6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
13 changes: 1 addition & 12 deletions core/utils/maintenance/graph_data_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@


async def build_indices_and_constraints(driver: AsyncDriver):
constraints: list[LiteralString] = [
"""
CREATE CONSTRAINT entity_name IF NOT EXISTS
FOR (n:Entity) REQUIRE n.name IS UNIQUE
""",
"""
CREATE CONSTRAINT edge_facts IF NOT EXISTS
FOR ()-[e:RELATES_TO]-() REQUIRE e.fact IS UNIQUE
""",
]

range_indices: list[LiteralString] = [
'CREATE INDEX entity_uuid IF NOT EXISTS FOR (n:Entity) ON (n.uuid)',
'CREATE INDEX episode_uuid IF NOT EXISTS FOR (n:Episodic) ON (n.uuid)',
Expand Down Expand Up @@ -64,7 +53,7 @@ async def build_indices_and_constraints(driver: AsyncDriver):
""",
]
index_queries: list[LiteralString] = (
constraints + range_indices + fulltext_indices + vector_indices
range_indices + fulltext_indices + vector_indices
)

await asyncio.gather(*[driver.execute_query(query) for query in index_queries])
Expand Down
1 change: 1 addition & 0 deletions examples/podcast/podcast_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ async def main(use_bulk: bool = True):
setup_logging()
client = Graphiti(neo4j_uri, neo4j_user, neo4j_password)
await clear_data(client.driver)
await client.build_indices_and_constraints()
messages = parse_podcast_messages()

if not use_bulk:
Expand Down

0 comments on commit 4c09e6c

Please # to comment.