Fix data format convert problem for PostgreSQL graph storage
This commit is contained in:
@@ -1100,11 +1100,14 @@ class PGGraphStorage(BaseGraphStorage):
|
|||||||
elif dtype == "edge":
|
elif dtype == "edge":
|
||||||
d[k] = json.loads(v)
|
d[k] = json.loads(v)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
d[k] = (
|
d[k] = (
|
||||||
json.loads(v)
|
json.loads(v)
|
||||||
if isinstance(v, str) and ("{" in v or "[" in v)
|
if isinstance(v, str) and (v.startswith("{") or v.startswith("["))
|
||||||
else v
|
else v
|
||||||
)
|
)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
d[k] = v
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user