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.
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.
Sorry for some late reply. Can you try something like this instead? The header name SHOULD be enclosed in a string in the USING clause:
e.g. USER_DEFINED_HEADER="test_header"
Example:
CREATE LOADING JOB layered_graph_loading_job_2 FOR GRAPH Test_ZD_57325 {
DEFINE FILENAME f;
DEFINE HEADER test_header = "source", "dest";
LOAD f TO VERTEX Test_Vertex_Layer VALUES ($"source") USING SEPARATOR=",", HEADER="true", EOL="\n", USER_DEFINED_HEADER="test_header";
LOAD f TO VERTEX Test_Vertex_Layer VALUES ($"dest") USING SEPARATOR=",", HEADER="true", EOL="\n", USER_DEFINED_HEADER="test_header";
LOAD f TO EDGE Has_Downstream VALUES ($"source", $"dest") USING SEPARATOR=",", HEADER="true", EOL="\n", USER_DEFINED_HEADER="test_header";
}
RUN LOADING JOB layered_graph_loading_job_2 USING f="/home/tigergraph/tigergraph/data/gui/loading_data/supawish.limprasert@tigergraph.com/layered_graph_edges.csv"
Note - the path you see in the RUN LOADING JOB is for a file that is uploaded by the user supawish.limprasert@tigergraph.com to the data loading page via GraphStudio: Load Data :: GraphStudio and Admin Portal
if you’re using default tigergraph user, path would be something like this: /home/tigergraph/tigergraph/data/gui/loading_data/tigergraph/layered_graph_edges.csv
note that this depends on where your TigerGraph was being installed as well
Can you try out defining the header WITHOUT defining the filename as seen in the example I provided and see if that works? If it doesn’t work via pyTigerGraph, but works via local loading job, this might be a limitation relating to pyTigerGraph.