I’m trying to apply my SQL experience to GSQL but it has failed me (again.)
from the TG 101 example, I got this query to work:
USE GRAPH social
CREATE QUERY hello(VERTEX<person> p) FOR GRAPH social{
Start = {p};
Result = SELECT tgt
FROM Start:s-(friendship:e) ->person:tgt;
PRINT Result;
}
The result does show a friend does contain age
attribute (here’s a portion of the result):
{'v_id': 'Jenny',
'attributes': {'gender': 'female',
'name': 'Jenny',
'state': 'tx',
'age': 25},
'v_type': 'person'}
I wanted to make a small change to return the friends’ age
. I would have expected this to work based on my experience with SQL, where I replaced SELECT tgt
with SELECT tgt.age
.
CREATE QUERY getFriendAge(VERTEX<person> p) FOR GRAPH social{
Start = {p};
Result = SELECT tgt.age
FROM Start:s-(friendship:e) ->person:tgt;
PRINT Result;
}
I get this error msg:
mismatched input '.' expecting FROM
where GSQL is complaining about the .
between tgt
and age
What am I missing? How do I get this to work?