cjm-graph-plugin-sqlite 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cjm_graph_plugin_sqlite-0.0.2/cjm_graph_plugin_sqlite.egg-info → cjm_graph_plugin_sqlite-0.0.4}/PKG-INFO +4 -5
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/README.md +1 -0
- cjm_graph_plugin_sqlite-0.0.4/cjm_graph_plugin_sqlite/__init__.py +1 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite/meta.py +8 -6
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite/plugin.py +29 -22
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4/cjm_graph_plugin_sqlite.egg-info}/PKG-INFO +4 -5
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/pyproject.toml +1 -1
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/settings.ini +2 -2
- cjm_graph_plugin_sqlite-0.0.2/cjm_graph_plugin_sqlite/__init__.py +0 -1
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/LICENSE +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/MANIFEST.in +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite/_modidx.py +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite.egg-info/SOURCES.txt +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite.egg-info/dependency_links.txt +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite.egg-info/entry_points.txt +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite.egg-info/not-zip-safe +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite.egg-info/requires.txt +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite.egg-info/top_level.txt +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/setup.cfg +0 -0
- {cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: cjm-graph-plugin-sqlite
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: A local, file-backed Context Graph worker for the cjm-plugin-system that implements graph storage, traversal, and querying using SQLite.
|
|
5
5
|
Home-page: https://github.com/cj-mills/cjm-graph-plugin-sqlite
|
|
6
6
|
Author: Christian J. Mills
|
|
@@ -10,10 +10,9 @@ Keywords: nbdev jupyter notebook python
|
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Natural Language :: English
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
14
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.12
|
|
17
16
|
Description-Content-Type: text/markdown
|
|
18
17
|
License-File: LICENSE
|
|
19
18
|
Requires-Dist: cjm_graph_plugin_system
|
|
@@ -26,7 +25,6 @@ Dynamic: description-content-type
|
|
|
26
25
|
Dynamic: home-page
|
|
27
26
|
Dynamic: keywords
|
|
28
27
|
Dynamic: license
|
|
29
|
-
Dynamic: license-file
|
|
30
28
|
Dynamic: provides-extra
|
|
31
29
|
Dynamic: requires-dist
|
|
32
30
|
Dynamic: requires-python
|
|
@@ -97,6 +95,7 @@ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest gen
|
|
|
97
95
|
|
|
98
96
|
# Plugin data directory
|
|
99
97
|
plugin_name = "cjm-graph-plugin-sqlite"
|
|
98
|
+
package_name = plugin_name.replace("-", "_")
|
|
100
99
|
if cjm_data_dir
|
|
101
100
|
"Return metadata required to register this plugin with the PluginManager."
|
|
102
101
|
```
|
|
@@ -63,6 +63,7 @@ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest gen
|
|
|
63
63
|
|
|
64
64
|
# Plugin data directory
|
|
65
65
|
plugin_name = "cjm-graph-plugin-sqlite"
|
|
66
|
+
package_name = plugin_name.replace("-", "_")
|
|
66
67
|
if cjm_data_dir
|
|
67
68
|
"Return metadata required to register this plugin with the PluginManager."
|
|
68
69
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.4"
|
{cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite/meta.py
RENAMED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/meta.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% auto 0
|
|
5
|
+
# %% auto #0
|
|
6
6
|
__all__ = ['get_plugin_metadata']
|
|
7
7
|
|
|
8
|
-
# %% ../nbs/meta.ipynb
|
|
8
|
+
# %% ../nbs/meta.ipynb #e175bfd5
|
|
9
9
|
import os
|
|
10
10
|
import sys
|
|
11
11
|
from typing import Any, Dict
|
|
12
|
+
from . import __version__
|
|
12
13
|
|
|
13
|
-
# %% ../nbs/meta.ipynb
|
|
14
|
+
# %% ../nbs/meta.ipynb #dd05fac7
|
|
14
15
|
def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest generation
|
|
15
16
|
"""Return metadata required to register this plugin with the PluginManager."""
|
|
16
17
|
# Fallback base path (current behavior for backward compatibility)
|
|
@@ -21,6 +22,7 @@ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest gen
|
|
|
21
22
|
|
|
22
23
|
# Plugin data directory
|
|
23
24
|
plugin_name = "cjm-graph-plugin-sqlite"
|
|
25
|
+
package_name = plugin_name.replace("-", "_")
|
|
24
26
|
if cjm_data_dir:
|
|
25
27
|
data_dir = os.path.join(cjm_data_dir, plugin_name)
|
|
26
28
|
else:
|
|
@@ -33,12 +35,12 @@ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest gen
|
|
|
33
35
|
|
|
34
36
|
return {
|
|
35
37
|
"name": plugin_name,
|
|
36
|
-
"version":
|
|
38
|
+
"version": __version__,
|
|
37
39
|
"type": "graph",
|
|
38
40
|
"category": "knowledge-management",
|
|
39
|
-
"interface": "
|
|
41
|
+
"interface": f"{package_name}.plugin_interface.GraphPlugin",
|
|
40
42
|
|
|
41
|
-
"module": "
|
|
43
|
+
"module": f"{package_name}.plugin",
|
|
42
44
|
"class": "SQLiteGraphPlugin",
|
|
43
45
|
|
|
44
46
|
# Critical: The absolute path to THIS environment's python
|
{cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite/plugin.py
RENAMED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/plugin.ipynb.
|
|
4
4
|
|
|
5
|
-
# %% auto 0
|
|
5
|
+
# %% auto #0
|
|
6
6
|
__all__ = ['SQLiteGraphPluginConfig', 'SQLiteGraphPlugin']
|
|
7
7
|
|
|
8
|
-
# %% ../nbs/plugin.ipynb
|
|
8
|
+
# %% ../nbs/plugin.ipynb #c187f00c
|
|
9
9
|
import json
|
|
10
10
|
import logging
|
|
11
11
|
import os
|
|
@@ -25,7 +25,7 @@ from cjm_graph_plugin_system.core import (
|
|
|
25
25
|
|
|
26
26
|
from .meta import get_plugin_metadata
|
|
27
27
|
|
|
28
|
-
# %% ../nbs/plugin.ipynb
|
|
28
|
+
# %% ../nbs/plugin.ipynb #6935e004
|
|
29
29
|
@dataclass
|
|
30
30
|
class SQLiteGraphPluginConfig:
|
|
31
31
|
"""Configuration for SQLite Graph Plugin."""
|
|
@@ -44,7 +44,7 @@ class SQLiteGraphPluginConfig:
|
|
|
44
44
|
}
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
-
# %% ../nbs/plugin.ipynb
|
|
47
|
+
# %% ../nbs/plugin.ipynb #5b7e1ced
|
|
48
48
|
class SQLiteGraphPlugin(GraphPlugin):
|
|
49
49
|
"""Local, file-backed Context Graph implementation using SQLite."""
|
|
50
50
|
|
|
@@ -132,26 +132,29 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
132
132
|
|
|
133
133
|
def _row_to_node(
|
|
134
134
|
self,
|
|
135
|
-
row: Tuple # DB row: (id, label, properties_json, sources_json)
|
|
135
|
+
row: Tuple # DB row: (id, label, properties_json, sources_json, created_at, updated_at)
|
|
136
136
|
) -> GraphNode: # Reconstructed GraphNode
|
|
137
137
|
"""Convert DB row to GraphNode DTO."""
|
|
138
138
|
props = json.loads(row[2]) if row[2] else {}
|
|
139
139
|
sources_raw = json.loads(row[3]) if row[3] else []
|
|
140
140
|
sources = [SourceRef(**s) for s in sources_raw]
|
|
141
|
-
return GraphNode(
|
|
141
|
+
return GraphNode(
|
|
142
|
+
id=row[0], label=row[1], properties=props, sources=sources,
|
|
143
|
+
created_at=row[4] if len(row) > 4 else None,
|
|
144
|
+
updated_at=row[5] if len(row) > 5 else None,
|
|
145
|
+
)
|
|
142
146
|
|
|
143
147
|
def _row_to_edge(
|
|
144
148
|
self,
|
|
145
|
-
row: Tuple # DB row: (id, source_id, target_id, relation_type, properties_json)
|
|
149
|
+
row: Tuple # DB row: (id, source_id, target_id, relation_type, properties_json, created_at, updated_at)
|
|
146
150
|
) -> GraphEdge: # Reconstructed GraphEdge
|
|
147
151
|
"""Convert DB row to GraphEdge DTO."""
|
|
148
152
|
props = json.loads(row[4]) if row[4] else {}
|
|
149
153
|
return GraphEdge(
|
|
150
|
-
id=row[0],
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
properties=props
|
|
154
|
+
id=row[0], source_id=row[1], target_id=row[2],
|
|
155
|
+
relation_type=row[3], properties=props,
|
|
156
|
+
created_at=row[5] if len(row) > 5 else None,
|
|
157
|
+
updated_at=row[6] if len(row) > 6 else None,
|
|
155
158
|
)
|
|
156
159
|
|
|
157
160
|
def _dict_to_node(
|
|
@@ -169,7 +172,9 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
169
172
|
id=data["id"],
|
|
170
173
|
label=data["label"],
|
|
171
174
|
properties=data.get("properties", {}),
|
|
172
|
-
sources=sources
|
|
175
|
+
sources=sources,
|
|
176
|
+
created_at=data.get("created_at"),
|
|
177
|
+
updated_at=data.get("updated_at"),
|
|
173
178
|
)
|
|
174
179
|
|
|
175
180
|
def _dict_to_edge(
|
|
@@ -182,7 +187,9 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
182
187
|
source_id=data["source_id"],
|
|
183
188
|
target_id=data["target_id"],
|
|
184
189
|
relation_type=data["relation_type"],
|
|
185
|
-
properties=data.get("properties", {})
|
|
190
|
+
properties=data.get("properties", {}),
|
|
191
|
+
created_at=data.get("created_at"),
|
|
192
|
+
updated_at=data.get("updated_at"),
|
|
186
193
|
)
|
|
187
194
|
|
|
188
195
|
# -------------------------------------------------------------------------
|
|
@@ -353,7 +360,7 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
353
360
|
"""Get a single node by ID."""
|
|
354
361
|
with sqlite3.connect(self._db_path) as con:
|
|
355
362
|
cur = con.execute(
|
|
356
|
-
"SELECT id, label, properties, sources FROM nodes WHERE id = ?",
|
|
363
|
+
"SELECT id, label, properties, sources, created_at, updated_at FROM nodes WHERE id = ?",
|
|
357
364
|
(node_id,)
|
|
358
365
|
)
|
|
359
366
|
row = cur.fetchone()
|
|
@@ -366,7 +373,7 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
366
373
|
"""Get a single edge by ID."""
|
|
367
374
|
with sqlite3.connect(self._db_path) as con:
|
|
368
375
|
cur = con.execute(
|
|
369
|
-
"SELECT id, source_id, target_id, relation_type, properties FROM edges WHERE id = ?",
|
|
376
|
+
"SELECT id, source_id, target_id, relation_type, properties, created_at, updated_at FROM edges WHERE id = ?",
|
|
370
377
|
(edge_id,)
|
|
371
378
|
)
|
|
372
379
|
row = cur.fetchone()
|
|
@@ -379,7 +386,7 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
379
386
|
"""Find all nodes linked to a specific external resource."""
|
|
380
387
|
# Use SQLite's json_each() to search within the sources JSON array
|
|
381
388
|
query = """
|
|
382
|
-
SELECT DISTINCT n.id, n.label, n.properties, n.sources
|
|
389
|
+
SELECT DISTINCT n.id, n.label, n.properties, n.sources, n.created_at, n.updated_at
|
|
383
390
|
FROM nodes n, json_each(n.sources) as src
|
|
384
391
|
WHERE json_extract(src.value, '$.plugin_name') = ?
|
|
385
392
|
AND json_extract(src.value, '$.row_id') = ?
|
|
@@ -407,7 +414,7 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
407
414
|
results = []
|
|
408
415
|
with sqlite3.connect(self._db_path) as con:
|
|
409
416
|
cur = con.execute(
|
|
410
|
-
"SELECT id, label, properties, sources FROM nodes WHERE label = ? LIMIT ?",
|
|
417
|
+
"SELECT id, label, properties, sources, created_at, updated_at FROM nodes WHERE label = ? LIMIT ?",
|
|
411
418
|
(label, limit)
|
|
412
419
|
)
|
|
413
420
|
for row in cur:
|
|
@@ -464,7 +471,7 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
464
471
|
placeholders = ','.join('?' for _ in edge_ids)
|
|
465
472
|
with sqlite3.connect(self._db_path) as con:
|
|
466
473
|
cur = con.execute(
|
|
467
|
-
f"SELECT id, source_id, target_id, relation_type, properties FROM edges WHERE id IN ({placeholders})",
|
|
474
|
+
f"SELECT id, source_id, target_id, relation_type, properties, created_at, updated_at FROM edges WHERE id IN ({placeholders})",
|
|
468
475
|
tuple(edge_ids)
|
|
469
476
|
)
|
|
470
477
|
for row in cur:
|
|
@@ -478,7 +485,7 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
478
485
|
if node_ids_in_context:
|
|
479
486
|
placeholders = ','.join('?' for _ in node_ids_in_context)
|
|
480
487
|
with sqlite3.connect(self._db_path) as con:
|
|
481
|
-
sql = f"SELECT id, label, properties, sources FROM nodes WHERE id IN ({placeholders})"
|
|
488
|
+
sql = f"SELECT id, label, properties, sources, created_at, updated_at FROM nodes WHERE id IN ({placeholders})"
|
|
482
489
|
|
|
483
490
|
# Apply optional label filtering
|
|
484
491
|
params = list(node_ids_in_context)
|
|
@@ -623,11 +630,11 @@ class SQLiteGraphPlugin(GraphPlugin):
|
|
|
623
630
|
all_edges = []
|
|
624
631
|
|
|
625
632
|
with sqlite3.connect(self._db_path) as con:
|
|
626
|
-
cur = con.execute("SELECT id, label, properties, sources FROM nodes")
|
|
633
|
+
cur = con.execute("SELECT id, label, properties, sources, created_at, updated_at FROM nodes")
|
|
627
634
|
for row in cur:
|
|
628
635
|
all_nodes.append(self._row_to_node(row))
|
|
629
636
|
|
|
630
|
-
cur = con.execute("SELECT id, source_id, target_id, relation_type, properties FROM edges")
|
|
637
|
+
cur = con.execute("SELECT id, source_id, target_id, relation_type, properties, created_at, updated_at FROM edges")
|
|
631
638
|
for row in cur:
|
|
632
639
|
all_edges.append(self._row_to_edge(row))
|
|
633
640
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: cjm-graph-plugin-sqlite
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: A local, file-backed Context Graph worker for the cjm-plugin-system that implements graph storage, traversal, and querying using SQLite.
|
|
5
5
|
Home-page: https://github.com/cj-mills/cjm-graph-plugin-sqlite
|
|
6
6
|
Author: Christian J. Mills
|
|
@@ -10,10 +10,9 @@ Keywords: nbdev jupyter notebook python
|
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Natural Language :: English
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
14
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.12
|
|
17
16
|
Description-Content-Type: text/markdown
|
|
18
17
|
License-File: LICENSE
|
|
19
18
|
Requires-Dist: cjm_graph_plugin_system
|
|
@@ -26,7 +25,6 @@ Dynamic: description-content-type
|
|
|
26
25
|
Dynamic: home-page
|
|
27
26
|
Dynamic: keywords
|
|
28
27
|
Dynamic: license
|
|
29
|
-
Dynamic: license-file
|
|
30
28
|
Dynamic: provides-extra
|
|
31
29
|
Dynamic: requires-dist
|
|
32
30
|
Dynamic: requires-python
|
|
@@ -97,6 +95,7 @@ def get_plugin_metadata() -> Dict[str, Any]: # Plugin metadata for manifest gen
|
|
|
97
95
|
|
|
98
96
|
# Plugin data directory
|
|
99
97
|
plugin_name = "cjm-graph-plugin-sqlite"
|
|
98
|
+
package_name = plugin_name.replace("-", "_")
|
|
100
99
|
if cjm_data_dir
|
|
101
100
|
"Return metadata required to register this plugin with the PluginManager."
|
|
102
101
|
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.2"
|
|
File without changes
|
|
File without changes
|
{cjm_graph_plugin_sqlite-0.0.2 → cjm_graph_plugin_sqlite-0.0.4}/cjm_graph_plugin_sqlite/_modidx.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|