TigerGraph Python Connection Issue

Hello,

I am having issue with connecting to GSQL using pyTigerGraph.

print(conn.echo())
Hello GSQL

print(conn.gsql(‘ls’))
FileNotFoundError: [Errno 2] No such file or directory: ‘/tmp/my-cert.txt’

@aalbaghd Are you using a windows machine running pyTigerGraph?

Yes, i am using a Windows machine.

Hi @aalbaghd - unfortunately the gsql function of pyTigerGraph requires a SSL certificate. To remedy this, you have to get a SSL certificate of your database, save that in a file, and then add the path to your connection details, so your TigerGraphConnection will look something like:

import pyTigerGraph as tg

conn = tg.TigerGraphConnection(host="YOUR_HOST", 
                               username="YOUR_USERNAME", 
                               ..., 
                               certPath="PATH_TO_SSL_CERT")

Hope this helps!

@aalbaghd Adding on to this thread.

Obtain SSL certificate

Run the following command, replacing <domain> with the domain of your Cloud solution and replace <path_to_certificate> with the local path to place the certificate file.

Find the domain of a Cloud solution by clicking on it in the solution view under “My Solutions.”

You need to install openssl on your client machine to run this command.

echo | openssl s_client  -connect <domain>:443 |  sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > <path_to_certificate>

I have placed the certificate in my local, but still it complains [Errno 2] No such file or directory: ‘/tmp/my-cert.txt’. I don’t have /tmp folder.

conn = tg.TigerGraphConnection(host=“https://”, username=“id”, password=“pwd”, certPath=“I:\ds\my-cert.txt”)

@Parker_Erickson @Jon_Herke Can you please help. Still facing the issue /tmp/my-cert.txt

@dgaddam Are you also in the Discord community? We have weekly events with the community “TigerGraph Graphe`” in which we can do a screen share to troubleshoot issues. Are you free to join tomorrow’s session?

TigerGraph Discord: https://discord.gg/tigergraph

1 Like

This has been solved by adding the .gsql folder in the user directory. example path as follows : C:\Users{user folder}.gsql

1 Like

Please wirte down steps in details @blackmiracle91

Thank you

@abhishek Here is another thread on Connecting to TigerGraph with Python (pyTigerGraph). There is also a link to a sample notebook that you can use to test your connection. Let me know if that helps. I trying to create connection but having an issue - #6 by Jon_Herke