Skip to content

Commit

Permalink
fix(query description): add version check
Browse files Browse the repository at this point in the history
  • Loading branch information
parkererickson-tg committed Apr 21, 2024
1 parent ec9c3d3 commit ecbdb1a
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions pyTigerGraph/pyTigerGraphQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def getStatistics(self, seconds: int = 10, segments: int = 10) -> dict:
return ret

def describeQuery(self, queryName: str, queryDescription: str, parameterDescriptions: dict = {}):
"""Add a query description and parameter descriptions.
"""Add a query description and parameter descriptions. Only supported on versions of TigerGraph >= 4.0.0.
Args:
queryName:
Expand All @@ -607,6 +607,11 @@ def describeQuery(self, queryName: str, queryDescription: str, parameterDescript
The response from the database.
"""
logger.info("entry: describeQuery")
self.ver =self.conn.getVer()
major_ver, minor_ver, patch_ver = self.ver.split(".")
if int(major_ver) < 4:
logger.info("exit: describeQuery")
raise TigerGraphException("This function is only supported on versions of TigerGraph >= 4.0.0.", 0)

if parameterDescriptions:
params = {"queries": [
Expand All @@ -630,7 +635,7 @@ def describeQuery(self, queryName: str, queryDescription: str, parameterDescript
return res

def getQueryDescription(self, queryName: Optional[Union[str, list]] = "all"):
"""Get the description of a query.
"""Get the description of a query. Only supported on versions of TigerGraph >= 4.0.0.
Args:
queryName:
Expand All @@ -642,6 +647,12 @@ def getQueryDescription(self, queryName: Optional[Union[str, list]] = "all"):
The description of the query(ies).
"""
logger.info("entry: getQueryDescription")
self.ver =self.conn.getVer()
major_ver, minor_ver, patch_ver = self.ver.split(".")
if int(major_ver) < 4:
logger.info("exit: getQueryDescription")
raise TigerGraphException("This function is only supported on versions of TigerGraph >= 4.0.0.", 0)

if logger.level == logging.DEBUG:
logger.debug("params: " + self._locals(locals()))

Expand All @@ -657,7 +668,7 @@ def getQueryDescription(self, queryName: Optional[Union[str, list]] = "all"):
raise TigerGraphException(res["message"], res["code"])

def dropQueryDescription(self, queryName: str, dropParamDescriptions: bool = True):
"""Drop the description of a query.
"""Drop the description of a query. Only supported on versions of TigerGraph >= 4.0.0.
Args:
queryName:
Expand All @@ -670,6 +681,12 @@ def dropQueryDescription(self, queryName: str, dropParamDescriptions: bool = Tru
The response from the database.
"""
logger.info("entry: dropQueryDescription")
self.ver =self.conn.getVer()
major_ver, minor_ver, patch_ver = self.ver.split(".")
if int(major_ver) < 4:
logger.info("exit: describeQuery")
raise TigerGraphException("This function is only supported on versions of TigerGraph >= 4.0.0.", 0)

if logger.level == logging.DEBUG:
logger.debug("params: " + self._locals(locals()))
if dropParamDescriptions:
Expand Down

0 comments on commit ecbdb1a

Please sign in to comment.