Query output as CSV instead of JSON

Is it possible to route query output in a CSV format instead of JSON? if yes, How can we do this?

Thanks
Khan

Yes, you can print the query result to local files. please refer to user document:

https://docs.tigergraph.com/dev/gsql-ref/querying/output-statements-and-file-objects#passing-a-file-object-as-a-parameter

Thanks.

https://docs.tigergraph.com/dev/gsql-ref/querying/output-statements-and-file-objects#printing-csv-to-a-file-object

Search CSV on that page.

It does not work with interpreted engine yet. But the compiled mode (install query) works. Here is an example.

USE GRAPH ldbc_snb

#pattern match syntax version is v2

SET syntax_version="v2"

DROP QUERY abc

# find 3 oldest person who knows viktor.

CREATE QUERY abc () FOR GRAPH ldbc_snb {

   SumAccum<int> @likesCnt = 0;

   FILE file1 ("/home/tigergraph/ldbc/a.csv");

   #start with all persons.

   Seed = {Person.*};

   #1-hop pattern.

   friends = SELECT p

             FROM Seed:s - (<Person_KNOWS_Person:e) - Person:p

             WHERE s.firstName == "Viktor" AND s.lastName == "Akhiezer"

             ORDER BY p.birthday ASC

             LIMIT 3;

   PRINT friends.birthday, friends.firstName, friends.lastName TO_CSV    file1;

}

install query abc

run query abc()