Using psycopg 3 driver with {cypher} queries returns broken JSON.
ArcadeDB Version:
ArcadeDB Server v25.1.1-SNAPSHOT (build 9e44506cad956c9014bc6bcffcdcf7d543518d9c/1734400152339/main) from dockerhub
OS and JDK Version:
Running on Linux 6.6.65-1-lts - OpenJDK 64-Bit Server VM 17.0.13 (Temurin-17.0.13+11)
Expected behavior
Return proper JSON with row_factory=dict_row
Actual behavior
With a query like this
{cypher} MATCH (a:`Brewery`)
SET a += {`abool`: False, `ajson`: [{`a`: [True, False]}]}
RETURN properties(a) as prop
LIMIT 1
I get a response like:
{'country': 'United States', 'ajson': '[{ a: [true, false]\n }]', 'website': 'http://512brewing.com/', 'code': '78745', 'address2': '', 'city': 'Austin', 'address1': '407 Radam, F200', 'abool': False, 'last_mod': 1279821600000.0, 'filepath': '', 'phone': '512.707.2337', 'name': '(512) Brewing Company', 'id': 1, 'state': 'Texas', 'descript': '(512) Brewing Company is a microbrewery located in the heart of Austin that brews for the community using as many local, domestic and organic ingredients as possible.', 'add_user': 0.0}
(it's cast to dict file type, but without a higher level prop key, and value for 'ajson' key is a string with a broken JSON)
If we have at least 2 return fields, like:
{cypher} MATCH (a:`Brewery`)
SET a += {`abool`: False, `ajson`: [{`a`: [True, False]}]}
RETURN properties(a) as prop, false as dummy
LIMIT 1
I get a dict with prop and dummy keys:
{'prop': '{ country: United States\najson: [{ a: [true, false]\n }]\nwebsite: http://512brewing.com/\ncode: 78745\naddress2: \ncity: Austin\naddress1: 407 Radam, F200\nabool: false\nlast_mod: 1.2798216E12\nfilepath: \nphone: 512.707.2337\nname: (512) Brewing Company\nid: 1\nstate: Texas\ndescript: (512) Brewing Company is a microbrewery located in the heart of Austin that brews for the community using as many local, domestic and organic ingredients as possible.\nadd_user: 0.0\n }', 'dummy': False}
But the value that corresponds to the 'prop' key is a broken JSON:
{ country: United States
ajson: [{ a: [true, false]
}]
website: http://512brewing.com/
code: 78745
address2:
city: Austin
address1: 407 Radam, F200
abool: false
last_mod: 1.2798216E12
filepath:
phone: 512.707.2337
name: (512) Brewing Company
id: 1
state: Texas
descript: (512) Brewing Company is a microbrewery located in the heart of Austin that brews for the community using as many local, domestic and organic ingredients as possible.
add_user: 0.0
}
Steps to reproduce
Here's the python script I use (the data is the OpenBeer demo):
import psycopg
from psycopg.rows import dict_row
DB = "Imported"
USER = "root"
PASSWORD = "playwithdata"
HOST = "localhost"
PORT = 5432
connection_string = (
f"dbname='{DB}' user='{USER}' password='{PASSWORD}' host='{HOST}' port={PORT}"
)
with psycopg.connect(connection_string) as conn:
with conn.cursor(row_factory=dict_row) as cursor:
cursor.execute(
"""{cypher}
MATCH (a:`Brewery`)
SET a += {`abool`: False, `ajson`: [{`a`: [True, False]}]}
RETURN properties(a) as prop, false as dummy
LIMIT 1
"""
)
record = cursor.fetchone()
print(record)
Somehow the broken JSON output is missing all quotes around keys and strings.
Using psycopg 3 driver with
{cypher}queries returns broken JSON.ArcadeDB Version:
ArcadeDB Server v25.1.1-SNAPSHOT (build 9e44506cad956c9014bc6bcffcdcf7d543518d9c/1734400152339/main)from dockerhubOS and JDK Version:
Running on Linux 6.6.65-1-lts - OpenJDK 64-Bit Server VM 17.0.13 (Temurin-17.0.13+11)Expected behavior
Return proper JSON with
row_factory=dict_rowActual behavior
With a query like this
I get a response like:
(it's cast to
dictfile type, but without a higher levelpropkey, and value for 'ajson' key is a string with a broken JSON)If we have at least 2 return fields, like:
I get a
dictwithpropanddummykeys:But the value that corresponds to the 'prop' key is a broken JSON:
Steps to reproduce
Here's the python script I use (the data is the OpenBeer demo):
Somehow the broken JSON output is missing all quotes around keys and strings.