How to push the local accumulator result to be outside of "attributes" dictionary

Hello @markmegerian can you guide me on this i have segment vertex and their childs have their seperate vertex because in future attributes going to be differ

  /* Write query logic here */ 
  TYPEDEF Tuple <STRING label, STRING id>  feature_score;
  ListAccum<feature_score> @childSegments;
  
  start = {segment_types.*};
  results = select s from start:s-(:ee)-:tt ACCUM s.@childSegments += feature_score(tt.label, tt.id);
  PRINT results; 
}
[
  {
    "results": [
      {
        "attributes": {
          "@childSegments": [
            {
              "id": "High Price Sensitivity",
              "label": ""
            },
            {
              "id": "Save and Splurge",
              "label": ""
            },
            {
              "id": "Low Price Sensitivity",
              "label": ""
            },
            {
              "id": "Mid Market",
              "label": ""
            }
          ]
        },
        "v_id": "Price Sensitivity",
        "v_type": "segment_types"
      }
    ]
  }
]

expected output, don’t want attributes object
I want directly @childSegments and the parent vertex Price Sensitivity future attributes in the same level

[
{ label: “P”,
id: “Price Se”,
children: [{ }]
},
[
{ label: “P”,
id: “Price Se”,
children: [{ }]
}
I can easily manipulate the output in backend, but want to know in GSQL as well

You can get more control over this behavior by using a global accumulator, which is named like this @@AccumName;

Where you can have multiple levels of nesting

However, in my experience, if you are using vertex attached accumulators, and you print out the combination of attributes and accumulators from a vertex set, you always get the attributes dictionary, which I always process using python.

1 Like