Tigergraph allows to load data before deleting process is completed

Hi Team,
In below given code for an existing graph, while I try to delete data before and reload it, I could see that before data is completely wiped, the loading is started.

Can you please suggest workaround for this

BEGIN

USE GRAPH ABC

delete from A
delete from B
delete from C
delete from D
delete from E

DROP JOB job_VT_A
DROP JOB job_VT_B
DROP JOB job_VT_C
DROP JOB job_VT_D
DROP JOB job_VT_E
DROP JOB job_ET_ABCDE

CREATE LOADING JOB job_VT_A FOR GRAPH ABC {
      DEFINE FILENAME job_VT_A = "/home/tigergraph/mydata/ABC/A.csv";
      LOAD job_VT_A TO VERTEX A VALUES($0, $1, $2, $3, $4) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
    }

CREATE LOADING JOB job_VT_B FOR GRAPH ABC {
      DEFINE FILENAME job_VT_B = "/home/tigergraph/mydata/ABC/B.csv";
      LOAD job_VT_B TO VERTEX B VALUES($0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, _, $15) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double", QUOTE="double";
    }

CREATE LOADING JOB job_VT_C FOR GRAPH ABC {
      DEFINE FILENAME job_VT_C = "/home/tigergraph/mydata/ABC/C.csv";
      LOAD job_VT_C TO VERTEX C VALUES($0, $5, $7, $9, $2, $13, $11, $8, $14, $4) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double", QUOTE="double";
    }

CREATE LOADING JOB job_VT_D FOR GRAPH ABC {
      DEFINE FILENAME job_VT_D = "/home/tigergraph/mydata/ABC/D.csv";
      LOAD job_VT_D TO VERTEX D VALUES($0, $1, $2, $3, $4, $5, $6) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
    }

CREATE LOADING JOB job_VT_E FOR GRAPH ABC {
      DEFINE FILENAME job_VT_E = "/home/tigergraph/mydata/ABC/E.csv";
      LOAD job_VT_E TO VERTEX E VALUES($0, $1, $2, $3, $4, $5) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
    }

CREATE LOADING JOB job_ET_ABCDE FOR GRAPH ABC {
      DEFINE FILENAME job_ET_ABCDE = "/home/tigergraph/mydata/ABC/ABCDE.csv";
      LOAD job_ET_ABCDE TO EDGE G VALUES($1, $8) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE H VALUES($0, $1) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE I VALUES($0, $4) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE J VALUES($0, $5) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE K VALUES($1, $6) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE L VALUES($8, $10, _, _) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE M VALUES($8, $9) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
      LOAD job_ET_ABCDE TO EDGE N VALUES($8, $2) USING SEPARATOR=",", HEADER="true", EOL="\n", QUOTE="double";
    }

RUN LOADING JOB job_VT_A
RUN LOADING JOB job_VT_B
RUN LOADING JOB job_VT_C
RUN LOADING JOB job_VT_D
RUN LOADING JOB job_VT_E
RUN LOADING JOB job_ET_ABCDE

END

Hello @gangadhar.p and welcome to the community forum!

Have you tried running CLEAR GRAPH STORE prior to your loading jobs? This command flushes all the data out of the database, but does not affect the schema.

Important things to note about this command: Use the -HARD option with extreme caution. There is no undo option. -HARD must be in all capital letters. CLEAR GRAPH STORE stops all the TigerGraph servers (GPE, GSE, RESTPP, Kafka, and Zookeeper). Loading jobs and queries are aborted.

Also, you can try the DROP JOB ALL command to drop all loading jobs at once if desired.

Here is the link to the docs on loading jobs!

Please let us know if this helps, and come back to us with any other questions you may have!

3 Likes

Hi @McKenzie_Steenson . I don’t want to clear whole data. Also, I am trying to use multiple graphs. When I delete data from single vertex type, I want to wait until whole data for that vertex type only is wiped clean.

Or you can suggest if I can print and save the count of vertex type into a text file into a directory.