Error with Loading Job: Loading Data to Edge

Hello,

I’m encountering an error when running a relatively simple loading job - I can’t ascertain what I’m doing wrong, any advice most welcome please!

First, the part of the graph where I’m having the issue is defined like this:

CREATE VERTEX Customer(PRIMARY_ID Cust_ID STRING, postcode STRING, DoB DATETIME) WITH primary_id_as_attribute="true"

CREATE VERTEX Product(PRIMARY_ID Prod_code STRING, Prod_ID STRING, purchase_date DATETIME) WITH primary_id_as_attribute="true"

CREATE UNDIRECTED EDGE Customer_Buys_Product(FROM Customer, TO Product, purchase_price INT, purchase_discount FLOAT)

CREATE GRAPH ExampleGraph (*)

I was actually using one CSV file and loading different columns in to the Customer and Product vertices, and then the last two columns in to the Customer_Buys_Product edge.
The CSV file - MyData.csv - is similar to this:

ID,code,purch_date,product_id,postcode,dob,cost,discount 111,A900,07/11/2022,8757,W1,12/06/1993,548.47,10.0 111,G400,04/04/2024,6442,EC2,21/05/2013,137.08,15.0

Here’s a facsimilie of the loading job I’m trying to run: basically, I’m trying to load columns ID, code, postcode, dob in to the Customer vertex; loading columns product_id and purch_date in to the Product vertex and then cost and discount in to the Customer_Buys_Product edge.

USE GRAPH ExampleGraph

BEGIN
CREATE LOADING JOB load_data FOR GRAPH ExampleGraph {

DEFINE FILENAME the_data = "ANY:/TigerGraph_Data/MyData.csv";

LOAD the_data TO VERTEX Customer VALUES($0, $1, $4, $5) USING HEADER = "TRUE", SEPARATOR = ",";

LOAD the_data TO VERTEX Product VALUES($2, $3) USING HEADER = "TRUE", SEPARATOR = ",";

LOAD the_data TO EDGE Customer_Buys_Product VALUES ($6, $7) USING HEADER = "TRUE", SEPARATOR = ",";
}
END

I tried running the load_data loading job, using just the_data.csv - then, I split it into two CSV files, separating the data to load in to the vertices from the data to load in to the edge. I get the same error in both cases:

Semantic Check Fails: values() index number is 2 while edge 'Customer_Buys_Product' has 4 columns! Failed to create loading jobs: [load_data].

I’ve clearly got something wrong in my “real” GSQL code, but I’m not understanding why the error message refers to the edge having 4 columns? I tried setting the purchase_price in the edge definition as a discriminator, and get the same error. Any advice most appreciated!

UPDATE: I realise my mistake, I hadn’t specified the complete loading job for the edges - forgot to add in the “from” and “to” columns to the load statement > I clearly need more sleep!! :rofl: