Add generated SQL columns for graph properties
AGE keeps all properties in one agtype column and its Cypher writes fire no triggers, so the bridge periodically calls a stored procedure that adds a stored generated text column for every new property key. Only label tables with inserts or updates since the previous run are scanned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04e1c32223
commit
7bd044ddb9
7 files changed
+225
-2
No files matched your search
@@ -4,9 +4,13 @@
|
||||
|
||||
Usage: python tests/smoke_test.py [bolt-uri] [user] [password]
|
||||
Requires: pip install neo4j
|
||||
Set PEO4C_SMOKE_PG_DSN (e.g. "host=localhost dbname=postgres") to also check the
|
||||
generated property columns over SQL; that needs psycopg.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
import neo4j
|
||||
from neo4j.graph import Node, Path, Relationship
|
||||
@@ -117,6 +121,22 @@ MATCH ()-[]->() RETURN { name:'relationships', data: count(*)} AS result
|
||||
|
||||
check("managed write transaction", s.execute_write(work) == 1)
|
||||
|
||||
dsn = os.environ.get("PEO4C_SMOKE_PG_DSN")
|
||||
if dsn:
|
||||
import psycopg
|
||||
|
||||
with psycopg.connect(dsn, user=user, password=password, autocommit=True) as pg:
|
||||
query = f'SELECT name, age FROM "{GRAPH}"."Person" ORDER BY name'
|
||||
for _ in range(30):
|
||||
try:
|
||||
rows = pg.execute(query).fetchall()
|
||||
break
|
||||
except psycopg.errors.UndefinedColumn:
|
||||
time.sleep(0.5)
|
||||
else:
|
||||
rows = None
|
||||
check("generated property columns", rows == [("Ann", "30"), ("Bob's", None)])
|
||||
|
||||
with driver.session(database="system") as s:
|
||||
s.run(f"DROP DATABASE {GRAPH}").consume()
|
||||
|
||||
|
||||
Reference in new issue
Block a user