Skip to content

Commit 93db622

Browse files
authored
Add specs for Neo4jRelationship to Python SDK. (#288)
1 parent f0bc867 commit 93db622

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

python/cocoindex/storages.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
"""All builtin storages."""
2-
from . import op
2+
from dataclasses import dataclass
33

4+
from . import op
5+
from .auth_registry import AuthEntryReference
46
class Postgres(op.StorageSpec):
57
"""Storage powered by Postgres and pgvector."""
68

79
database_url: str | None = None
810
table_name: str | None = None
11+
12+
@dataclass
13+
class Neo4jConnectionSpec:
14+
"""Connection spec for Neo4j."""
15+
uri: str
16+
user: str
17+
password: str
18+
db: str | None = None
19+
20+
@dataclass
21+
class Neo4jNodeSpec:
22+
"""Spec for a Neo4j node type."""
23+
field_name: str
24+
label: str
25+
26+
class Neo4jRelationship(op.StorageSpec):
27+
"""Graph storage powered by Neo4j."""
28+
29+
connection: AuthEntryReference
30+
relationship: str
31+
source_node: Neo4jNodeSpec
32+
target_node: Neo4jNodeSpec

src/ops/storages/neo4j.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ impl StorageFactoryBase for RelationshipFactory {
663663
type Key = GraphRelationship;
664664

665665
fn name(&self) -> &str {
666-
"Neo4j"
666+
"Neo4jRelationship"
667667
}
668668

669669
fn build(

0 commit comments

Comments
 (0)