Closed richard-julien closed 1 year ago
@richard-julien , as a workaround for now (though this may be expensive in terms of queries), you can do:
match $x isa User; $x has attribute $a; get;
And then collect all the different attributes that come in in different answers for the same user together :)
What @flyingsilverfin suggested above is the official alternative/workaround, actually. I get that it's not entirely identical, as the attributes need to be collected from all entries in the map, as opposed to one entry containing all attributes.
Did this workaround, work for you, @richard-julien ?
Hi @haikalpribadi , for now we use a different approach. Will try this approach asap to see if it speedup the queries :)
Closing for now since the has attribute $a
is still the recommended approach. This can be used with a group $x
to make sure the user doesn't have to collect the values themselves if they arrive out of order.
Problem to Solve
When using Graql every attributes needed in the result must be expressed in the query. For grakn as a SQL like database it can be a bit annoying to express the 25 attributes required.
Current Workaround
No workaround, we need to express all the fields you need
Proposed Solution
Add in the language the SQL select * way of fetching data.
Proposal
Have more convention for variable naming if not specified. like.
match $user isa User; has name $n; has email; get;
And so by convention for every attributes
match $user isa User; has *; get;