admin管理员组文章数量:1313347
I'm having issues with extracting any string properties from an Apache AGE graph to PostgreSQL. It seems like AGE is adding double quotes (") to each string when the node gets created and when it's returned to regular SQL, it thinks that the quotes are part of the string itself. Happens to all properties as long as the type is string.
This causes an issue down the line when I'm trying to run a JOIN statement that includes a Cypher query - the join condition isn't picking up because the string aren't the same.
I use PostgreSQL 14.15, Apache AGE 1.5.0 and psycopg2 2.9.6 to communicate with db via Python
Here's my create statement for the node:
SELECT *
FROM cypher('graph',
$$ CREATE (n:NODE {id: "1b920981-635b-4e46-bb75-17ab6cac9716"}) $$)
as (a agtype);
When I try to retrieve it, the end result looks like this:
query = '''SELECT * FROM
cypher('graph', $$
MATCH (b:NODE)
WHERE b.id = '1b920981-635b-4e46-bb75-17ab6cac9716'
RETURN b.id
$$) as graph_query(id varchar)
'''
with conn.cursor() as cursor:
cursor.execute(query)
print(cursor.fetchall())
connmit()
[('"1b920981-635b-4e46-bb75-17ab6cac9716"',)]
That '"{id}"' is the issue - somehow the double quotes become part of the string. If I switch graph_query(id varchar) to graph_query(id agtype), issue persists.
本文标签:
版权声明:本文标题:Apache AGE seems to add double quotation marks on string properties - causes issues when trying to join in a regular SQL query - 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741913399a2404578.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论