Semicolon needed when? better err msgs from pyTigerGraph?

Sorry for these couple of noob questions… Google didn’t turn up anything for me…

A.

I’m used to semicolons being optional in SQL. I usually tack them on anyway having programmed in C/C++. Apparently, Microsoft documentation says that a semicolon will be required in future versions of SQL Server. To preserve my sanity, I’d like to keep my SQL-like programming as similar as possible.

So, I’m surprised to see that in TG, this is forbidden:

 SELECT * FROM person limit 3;   // SEMICOLON
Encountered " ";" "; "" at line 1, column 29.
Was expecting:
    <EOF> 

This works:

 SELECT * FROM person limit 3 // NO SEMICOLON

B.
When I tried the same query in pyTigerGraph (python library), I got the obscure error (for which Google returned no results!): ExceptionCodeRet: 211. Is there a way to get better diagnostic info from pyTigerGraph?

query = """
USE GRAPH social
SELECT * FROM person limit 3;  // SEMICOLON FORBIDDEN
"""
print(graph.gsql(query, options=[]))

---------------------------------------------------------------------------
ExceptionCodeRet                          Traceback (most recent call last)
<ipython-input-223-30fbb5ef9795> in <module>
      3 SELECT * FROM person limit 3;
      4 """
----> 5 print(graph.gsql(query, options=[]))

~/3.7/lib/python3.8/site-packages/pyTigerGraph/pyTigerGraph.py in gsql(self, query, options)
   1615                     return  res
   1616             else:
-> 1617                 res =  self.Client.run_multiple(query.split("\n"))
   1618                 if type(res) == type([]):
   1619                     return "\n".join(res)

~/3.7/lib/python3.8/site-packages/pyTigerDriver/pyDriver.py in run_multiple(self, lines)
    439 
    440     def run_multiple(self, lines):
--> 441         return self._command_interactive(self.file_url, "\n".join(lines))
    442 
    443     def version(self):

~/3.7/lib/python3.8/site-packages/pyTigerDriver/pyDriver.py in _command_interactive(self, url, content, ans, out)
    364             return res
    365 
--> 366         return self._request(url, content, __handle__interactive)
    367 
    368     def login(self,commit_try="",version_try=""):

~/3.7/lib/python3.8/site-packages/pyTigerDriver/pyDriver.py in _request(self, url, content, handler, cookie, auth)
    318             if handler:
    319                 reader = codecs.getreader("utf-8")(response)
--> 320                 return handler(reader)
    321             else:
    322                 return response.read().decode("utf-8")

~/3.7/lib/python3.8/site-packages/pyTigerDriver/pyDriver.py in __handle__interactive(reader)
    340                     ret = int(ret)
    341                     if ret != 0:
--> 342                         raise ExceptionCodeRet(ret)
    343                 elif line.startswith(PREFIX_INTERACT):
    344                     _, it, ik = line.split(",", 2)

ExceptionCodeRet: 211
​```

`tg.__version__   => '0.0.9.6.6'`

Thanks in advance.
1 Like

Part B is really a problem with pyTigerGraph, so I filed a github issue

1 Like

@clemwang Thanks a lot for the detailed Issue report on Github , the GSQL errors reported by pyTigerGraph are based on TG error codes ( 2xx … ) we’re working on the error handling .
We will issue a new version by 8th of May 2021 containing a better exception handling .

I found the GSQL error code definitions

1 Like