-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgres driver returns nothing with INSERT INTO .... RETURN @rid
but RID with RETURN @rid.asString()
#2038
Comments
Could be similar to try:
with connection.cursor() as cursor:
cursor.execute(f"create vertex type `TEST_TYPE_DEBUG` if not exists;")
cursor.execute(f"create property TEST_TYPE_DEBUG.str if not exists STRING;")
#cursor.execute(f'INSERT INTO TEST_TYPE_DEBUG (str) VALUES (%s) return str', ("mdrrrrrrrrr",))
cursor.execute(f"{{cypher}}match (n) return count(n)")
cursor.execute(f"""{{cypher}}CREATE (n:TEST_TYPE_DEBUG {{str: 'lol'}})
RETURN n""")
ret = cursor.fetchone()
print(ret)
finally:
connection.close()
Returning |
It happens beacause of those lines : Object value = switch (propertyName) {
case "@rid" -> row.isElement() ? row.getElement().get().getIdentity() : null;
case "@type" -> row.isElement() ? row.getElement().get().getTypeName() : null;
|
If you do a query with projections, like "select firstName, lastName from client", then there is no element in the result set (the record/document/vertex/edge). Otherwise, if you do "select from client", then the whole record is used and returned, very similar to "select * from client". |
But the first insert should return the rid, so there is an issue there. |
For the very first post, it works with Turning
Into
Fixes the issue but is it really what we should do ? |
The cypher query also should work in my opinion as I do |
I think this is actually correct: if not an element, it should try as a property. 👏 |
Hello,
I started writing more test for @robfrank 's python tests.
As per my previous opened discussion we just started exploring postgres driver usage.
Long story short here is the code :
It returns
[(None,)]
withRETURN @rid
[('#213:6',)]
withRETURN @rid.asString()
Is it expected ?
The text was updated successfully, but these errors were encountered: