From 98e0373fbe43c1163170961a9c06f918c67f9aad Mon Sep 17 00:00:00 2001 From: AKASHSE-123 Date: Sun, 14 May 2023 10:52:34 +0530 Subject: [PATCH 1/3] [akash]Adding Query ID in Failed Query --- e6xdb/server/QueryEngineService-remote | 2 +- e6xdb/server/QueryEngineService.py | 2 +- e6xdb/server/constants.py | 2 +- e6xdb/server/ttypes.py | 20 +++++++++++++++++--- server.thrift | 1 + 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/e6xdb/server/QueryEngineService-remote b/e6xdb/server/QueryEngineService-remote index 72c151c..c49a243 100755 --- a/e6xdb/server/QueryEngineService-remote +++ b/e6xdb/server/QueryEngineService-remote @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.17.0) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/e6xdb/server/QueryEngineService.py b/e6xdb/server/QueryEngineService.py index 711be11..6ebd561 100644 --- a/e6xdb/server/QueryEngineService.py +++ b/e6xdb/server/QueryEngineService.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.17.0) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/e6xdb/server/constants.py b/e6xdb/server/constants.py index 511b9ca..a352d6b 100644 --- a/e6xdb/server/constants.py +++ b/e6xdb/server/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.17.0) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/e6xdb/server/ttypes.py b/e6xdb/server/ttypes.py index 3b7813e..e962f07 100644 --- a/e6xdb/server/ttypes.py +++ b/e6xdb/server/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.17.0) +# Autogenerated by Thrift Compiler (0.18.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -20,12 +20,14 @@ class QueryProcessingException(TException): """ Attributes: - reason + - queryId """ - def __init__(self, reason=None,): + def __init__(self, reason=None, queryId=None,): super(QueryProcessingException, self).__setattr__('reason', reason) + super(QueryProcessingException, self).__setattr__('queryId', queryId) def __setattr__(self, *args): raise TypeError("can't modify immutable instance") @@ -34,7 +36,7 @@ def __delattr__(self, *args): raise TypeError("can't modify immutable instance") def __hash__(self): - return hash(self.__class__) ^ hash((self.reason, )) + return hash(self.__class__) ^ hash((self.reason, self.queryId, )) @classmethod def read(cls, iprot): @@ -42,6 +44,7 @@ def read(cls, iprot): return iprot._fast_decode(None, iprot, [cls, cls.thrift_spec]) iprot.readStructBegin() reason = None + queryId = None while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: @@ -51,12 +54,18 @@ def read(cls, iprot): reason = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + queryId = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() return cls( reason=reason, + queryId=queryId, ) def write(self, oprot): @@ -68,6 +77,10 @@ def write(self, oprot): oprot.writeFieldBegin('reason', TType.STRING, 1) oprot.writeString(self.reason.encode('utf-8') if sys.version_info[0] == 2 else self.reason) oprot.writeFieldEnd() + if self.queryId is not None: + oprot.writeFieldBegin('queryId', TType.STRING, 2) + oprot.writeString(self.queryId.encode('utf-8') if sys.version_info[0] == 2 else self.queryId) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -319,6 +332,7 @@ def __ne__(self, other): QueryProcessingException.thrift_spec = ( None, # 0 (1, TType.STRING, 'reason', 'UTF8', None, ), # 1 + (2, TType.STRING, 'queryId', 'UTF8', None, ), # 2 ) all_structs.append(AccessDeniedException) AccessDeniedException.thrift_spec = ( diff --git a/server.thrift b/server.thrift index 36ee17a..6e0e35c 100644 --- a/server.thrift +++ b/server.thrift @@ -3,6 +3,7 @@ namespace java io.e6x.engine.thrift exception QueryProcessingException { 1: string reason, + 2: string queryId, } exception AccessDeniedException From 015ee5c964a41ba0b1be9b97eb7d642e224044af Mon Sep 17 00:00:00 2001 From: AKASHSE-123 Date: Sun, 14 May 2023 11:11:17 +0530 Subject: [PATCH 2/3] [akash]Updating Test case --- tests.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests.py b/tests.py index 486a5c7..db4bd30 100644 --- a/tests.py +++ b/tests.py @@ -3,7 +3,7 @@ import time from unittest import TestCase import e6xdb.e6x as edb - +import json import logging logging.getLogger(__name__) @@ -19,16 +19,9 @@ def setUp(self) -> None: self.e6x_connection = edb.connect( host=self._host, port=9000, - scheme='e6xdb', username='vishal@e6x.io', database=self._database, - auth=None, - configuration=None, - kerberos_service_name=None, password='75cei^%$TREdgfhU&T^RTYDrchfgvjy65dhcgf', - check_hostname=None, - ssl_cert=None, - thrift_transport=None ) logging.debug('Successfully to connect to engine.') @@ -97,13 +90,13 @@ def test_query_5_dry_run(self): def test_query_5_caches(self): sql = "select * from date_dim limit 3" logging.debug('Executing query: {}'.format(sql)) - self.e6x_connection.set_or_update_caches(True) + self.e6x_connection.set_prop_map(json.dumps(dict(USE_QUERY_RESULT_CACHE=True))) cursor = self.e6x_connection.cursor() query_id = cursor.execute(sql) logging.debug('Query Id {}'.format(query_id)) self.assertIsNotNone(query_id) records = cursor.fetchall() - self.e6x_connection.set_or_update_caches(False) + self.e6x_connection.set_prop_map(json.dumps(dict(USE_QUERY_RESULT_CACHE=False))) now = time.time() query_id = cursor.execute(sql) logging.debug('Query Id {}'.format(query_id)) From 80b35b1f710e8381675579f61b5c3493ef11c5a9 Mon Sep 17 00:00:00 2001 From: AKASHSE-123 Date: Sun, 14 May 2023 11:18:03 +0530 Subject: [PATCH 3/3] [akash]Updating Readme and setup file --- README.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 06391cc..c04918b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # e6data Python Connector -![version](https://img.shields.io/badge/version-1.0.3-blue.svg) +![version](https://img.shields.io/badge/version-1.0.4-blue.svg) ## Introduction diff --git a/setup.py b/setup.py index 2b9b859..a42bc37 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ envstring = lambda var: os.environ.get(var) or "" -VERSION = [1, 0, 3] +VERSION = [1, 0, 4] def get_long_desc():