mogui/pyorient

Incorrectly formatted output when using multiple include clauses in select statement

Opened this issue · 0 comments

This is the how my database is

import pyorient

client = pyorient.OrientDB("localhost", 2424)
dbName = "test"
user = "root"
password = "password"
session_id = client.connect(user, password)
client.db_create(dbName, pyorient.DB_TYPE_GRAPH, pyorient.STORAGE_TYPE_MEMORY)
client.db_open(dbName, user, password)

# Creating 2 vertices
client.command("CREATE CLASS Person EXTENDS V")
client.command("CREATE VERTEX Person SET name = 'Luca2'")
client.command("create class cycle extends V")
client.command("create vertex cycle SET name = 'cycle2'")

# Creating an edge and putting a constraint on the edge
client.command("create class cycler extends E")
client.command("create property cycler.out link Person")
client.command("create property cycler.in link cycle")
e = client.command("create edge cycler from ( SELECT FROM Person where name = 'Luca2') TO ( SELECT FROM cycle where name='cycle2')")
# Updating the edge to have an id attribute
client.command("update cycler set id = 1 where @rid={}".format(e[0]._rid))

Now executing this query

result = client.command("select @this.include('id'), out.include('name') from cycler where id = 1")[0].oRecordData

The output is

{'this': {'(name': 'Luca2', 'id': '1),out'}}

Here result is a dictionary with only one key this where it should have been a dictionary with 2 keys id and name. Whats more wrong is the value of result['this'].

result['this']
>>> {'(name': 'Luca2', 'id': '1),out'}
result['this'].keys()
>>> dict_keys(['id', '(name'])
result['this'].values()
>>> dict_values(['1),out', 'Luca2'])