Create Loading Jobs using GSQL

I have been trying to create a loading job from pyTigerGraph using:

print(conn.gsql(’’’
DROP JOB LOAD_FINNET_1
CREATE LOADING JOB LOAD_FINNET_1 FOR GRAPH FINNET {
DEFINE FILENAME master_file;
LOAD master_file TO VERTEX master VALUES($0, $1, $2, $3, $4, $5, $6) USING HEADER=“true”, SEPARATOR=",", EOL="\n";
}
‘’’))

But I am getting an error ExceptionCodeRet: 211

I am running as super user in a tgcloud instance. The print(conn.gsql(’’‘LS’’’, options=[])) works well. What could be the problem?

Thank you,
Victor.

@vihuma My guess is when setting up conn (connection) the graph wasn’t defined. I slightly modified your query by adding USE GRAPH FINNET_1 in the GSQL chuck. Can you let me know if you still get the same error?

Revised GSQL Chunk:

    print(conn.gsql('''
    USE GRAPH FINNET_1
    DROP JOB LOAD_FINNET_1
    CREATE LOADING JOB LOAD_FINNET_1 FOR GRAPH FINNET {
    DEFINE FILENAME master_file;
    LOAD master_file TO VERTEX master VALUES($0, $1, $2, $3, $4, $5, $6) USING HEADER=“true”, SEPARATOR=",", EOL="\n";
    }
    '''))

Hi Jon,
Thank you for the reply but it still did not work. When I open the connection I do provide the graph name.
Might it have to do with the version or permissions? I am running as super user.
Victor

@vihuma what version of pyTigerGraph are you running? And is it a cloud instance?

1 Like

pyTigerGraph version is 0.0.9.6.6 and yes, it is a cloud instance.

can you please upgrade pyTG? 0.0.9.8.5 is latest version
pip install -U pyTigerGraph
or
pip3 install -U pyTigerGraph
depending on py version you are using?

1 Like

I upgraded to the new version but now I have the problem that the connection is not working.
I am using:

    conn = tg.TigerGraphConnection(host=hostname,
                                graphname=graphname,
                                username=username,
                                password=password)

where I initialized the graphname, username, and password to the appropriate values.
The error I am getting when I do conn.gsql((’’‘LS’’’)) is :

Connection Failed check your Username/Password init() got an unexpected keyword argument ‘gsPort’
Couldn’t Initialize the client see Above Error

I also run it with version=“3.0.6” and “3.1.0”, restPort=9000, and gsPort=14240 but I get same error.

This might have to do with an older version of TigerGraph in the cloud instance? I have version v3.0.6.

@vihuma

please try this way of creating connection:

conn = tg.TigerGraphConnection(host=cfg.host,password=cfg.password)
conn.graphname = cfg.graphname
cfg.token = conn.getToken(cfg.secret, cfg.tokenlifetime) 

Bruno

I am getting the same error. I am using

conn = tg.TigerGraphConnection(host=hostname,password=password)
conn.graphname = graphname
token = conn.getToken(secret)

I found the problem. I updated pyTigerGraph but did not update pyTigerDriver. I just did both and it works.
Thank you.

1 Like