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>