Error when using USER_DEFINED_HEADER parameter

I’m trying to run a load job remotely via the restapi’s with named columns. When I try to exectue the below load job, I receive the following error:
Error: TigerGraphException('Encountered " "USER_DEFINED_HEADER “” at line 7, column 95.
Was expecting:
“reject_line_rule” …
')
--------------------Load Job ---------------------
Use Graph UserProfile_Graph
CREATE LOADING JOB UserProfile_Graph_Vertex_Job FOR GRAPH UserProfile_Graph {
DEFINE FILENAME DS1 = “PersonProfiles.csv”;

DEFINE HEADER DS1_header = “id”,“FirstName”,“LastName”,“Gender”,“Date of Birth”,“Age”,“Height”,“Weight”,“Email”,“Phone_Number”,“Address”,“City”,“City_Fips”,“County”,“State”,“Zip”,“Product_ID”,“DeviceType”;

LOAD DS1 TO VERTEX Person VALUES("id", “FirstName”, "LastName", “Gender”, $“Age”) USING USER_DEFINED_HEADER=DS1_header, SEPARATOR=“,”, HEADER=“true”, QUOTE=“double”, EOL=“\n”;

}
#drop the job, indicating the job is completed
DROP JOB UserProfile_Graph_Vertex_Job

Does TigerGraph support remote execution of Loading jobs with named columns? It would be great to see an example of the DEFINE HEADER / USER_DEFINED_HEADER parameter combination to accomplish this task.

Hi Demit,

While loading, we have to mention the column header with the $ character. You added it for Age, but the remaining columns still need it.

Please ensure:

  1. The DSQ_header order and the file header order are the same.
  2. Ensure the file path is correct — it’s better to mention the path explicitly, or pass it at runtime.
CREATE LOADING JOB UserProfile_Graph_Vertex_Job FOR GRAPH UserProfile_Graph {
  DEFINE FILENAME DS1 = "PersonProfiles.csv";
  DEFINE HEADER DS1_header = "id","FirstName","LastName","Gender","Date of Birth","Age","Height","Weight","Email","Phone_Number","Address","City","City_Fips","County","State","Zip","Product_ID","DeviceType";
  LOAD DS1 TO VERTEX Person VALUES($"id", $"FirstName", $"LastName", $"Gender", $"Age") USING USER_DEFINED_HEADER=DS1_header, SEPARATOR=",", HEADER="true", QUOTE="double", EOL="\n";
}

Thanks,
Anand G

1 Like

Hi Anand,

So, the actual job has $ before each column name. The code is getting transformed by the editor (notice the " (double quote character), it is a 201c / 201d, not 22) when I cut/paste it:

Also, the filename is passed in at runtime, so the name is there only for my python code to get a reference.

Have you been able to reproduce this error or even better yet, are you able run a load job using the DEFINE HEADER / USER_DEFINED_HEADER combination?

I’m using the runLoadingJobWithData() function to load the data.

Kind Regards,

Mitch DeFelice