PyTigergraph loading data syntax

Hi, i am having issue when loading the data to the tigergraph cloud from the google colab.
I initially uploaded data into my google colab using the following command and I can see the file contents
from google.colab import files
uploaded = files.upload()

when i try to source the file to the tigergraph load job it failed with an error. Can you tell me what is the correct syntax.

dataSource = “/content/ncvr_numrec_1000000_modrec_2_ocp_20_myp_0_nump_5.csv”
results = conn.gsql(’’’
USE GRAPH MyGraph
RUN LOADING JOB load_voters USING MyDataSource="’+dataSource’"
‘’’)
print(results)

Semantic Check Fails: File or directory ‘dataSource’ does not exist!
Semantic Check Fails: The FILENAME = ‘m1:dataSource’ is not in a valid path format.

hey @sai

you can try the following :

import pyTigerGraph as tg

conn = tg.TigerGraphConnection(...)
conn.graphname = 'MyGraph'
conn.apiToken = conn.getToken(conn.createSecret())

# Upload the File
filePath = “/content/ncvr_numrec_1000000_modrec_2_ocp_20_myp_0_nump_5.csv”
jobName = "load_voters"
fileTag = "MyDataSource"
conn.uploadFile( filePath, fileTag, jobName, timeout=32000)
# All done ! 

1 Like