diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27abda1..d6ab5c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install ".[dev]" --group=pyhive + python -m pip install ".[dev,spark]" wget https://dlcdn.apache.org/spark/spark-4.0.1/spark-4.0.1-bin-hadoop3.tgz tar -xzf spark-4.0.1-bin-hadoop3.tgz export SPARK_HOME=$(pwd)/spark-4.0.1-bin-hadoop3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a1deb1..bda66de 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,5 +6,7 @@ repos: # Run the linter. - id: ruff args: [ --fix ] + exclude: chronify/_vendor/.* # Run the formatter. - id: ruff-format + exclude: chronify/_vendor/.* diff --git a/pyproject.toml b/pyproject.toml index 25efd40..03e7a0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,16 @@ dependencies = [ "rich", "sqlalchemy == 2.0.37", "tzdata", + # Required by pyhive + "future", + "python-dateutil", ] + [project.optional-dependencies] +spark = [ + "thrift", + "thrift_sasl", +] dev = [ "mypy >= 1.15, < 2", @@ -55,12 +63,10 @@ dev = [ "sphinx-tabs~=3.4", ] -[dependency-groups] -pyhive = [ - "pyhive @ git+https://github.com/apache/kyuubi.git@3b205a3924e0e3a75c425de1396089729cf22ee5#subdirectory=python", - "thrift", - "thrift_sasl", -] +[project.entry-points."sqlalchemy.dialects"] +hive = "pyhive.sqlalchemy_hive:HiveDialect" +"hive.http" = "pyhive.sqlalchemy_hive:HiveHTTPDialect" +"hive.https" = "pyhive.sqlalchemy_hive:HiveHTTPSDialect" [project.urls] Documentation = "https://github.com/NREL/chronify#readme" @@ -71,7 +77,9 @@ Source = "https://github.com/NREL/chronify" files = [ "src", ] -disable_error_code = ["no-untyped-call"] +exclude = [ + "src/chronify/_vendor/*", +] strict = true [tool.pytest.ini_options] @@ -91,6 +99,7 @@ exclude = [ "dist", "env", "venv", + "src/chronify/_vendor/*", ] line-length = 99 diff --git a/src/chronify/__init__.py b/src/chronify/__init__.py index 0ca60e7..a61ca6c 100644 --- a/src/chronify/__init__.py +++ b/src/chronify/__init__.py @@ -1,5 +1,8 @@ import importlib.metadata as metadata +import sys +from chronify._vendor.kyuubi import TCLIService +from chronify._vendor.kyuubi import pyhive from chronify.exceptions import ( ChronifyExceptionBase, ConflictingInputsError, @@ -59,3 +62,8 @@ ) __version__ = metadata.metadata("chronify")["Version"] + + +# Make pyhive importable as if it were installed separately. +sys.modules["pyhive"] = pyhive +sys.modules["TCLIService"] = TCLIService diff --git a/src/chronify/_vendor/kyuubi/LICENSE b/src/chronify/_vendor/kyuubi/LICENSE new file mode 100644 index 0000000..f49a4e1 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/src/chronify/_vendor/kyuubi/README.md b/src/chronify/_vendor/kyuubi/README.md new file mode 100644 index 0000000..b71db55 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/README.md @@ -0,0 +1,12 @@ +This source code is copied from https://github.com/apache/kyuubi.git, +commit ID 3b205a3924e0e3a75c425de1396089729cf22ee5. We did not modify the code. + +The pyhive package is marked as not supported, but we need it to work with Spark. +The latest published version of pyhive on pypi.org is not compatible with current versions of +sqlalchemy and Apache Spark. Specifically, we require the patch made in commit ID +a0b9873f817267675eab304f6935bafa4ab0f731. + +We have validated this version of pyhive with our use cases. We will remove this code as +soon as Kyuubi publishes an updated version on pypi.org. + +The pyhive license file is included here. diff --git a/src/chronify/_vendor/kyuubi/TCLIService/TCLIService-remote b/src/chronify/_vendor/kyuubi/TCLIService/TCLIService-remote new file mode 100755 index 0000000..8d875fa --- /dev/null +++ b/src/chronify/_vendor/kyuubi/TCLIService/TCLIService-remote @@ -0,0 +1,264 @@ +#!/usr/bin/env python +# +# Autogenerated by Thrift Compiler (0.10.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +import sys +import pprint +if sys.version_info[0] > 2: + from urllib.parse import urlparse +else: + from urlparse import urlparse +from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient +from thrift.protocol.TBinaryProtocol import TBinaryProtocol + +from TCLIService import TCLIService +from TCLIService.ttypes import * + +if len(sys.argv) <= 1 or sys.argv[1] == '--help': + print('') + print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' TOpenSessionResp OpenSession(TOpenSessionReq req)') + print(' TCloseSessionResp CloseSession(TCloseSessionReq req)') + print(' TGetInfoResp GetInfo(TGetInfoReq req)') + print(' TExecuteStatementResp ExecuteStatement(TExecuteStatementReq req)') + print(' TGetTypeInfoResp GetTypeInfo(TGetTypeInfoReq req)') + print(' TGetCatalogsResp GetCatalogs(TGetCatalogsReq req)') + print(' TGetSchemasResp GetSchemas(TGetSchemasReq req)') + print(' TGetTablesResp GetTables(TGetTablesReq req)') + print(' TGetTableTypesResp GetTableTypes(TGetTableTypesReq req)') + print(' TGetColumnsResp GetColumns(TGetColumnsReq req)') + print(' TGetFunctionsResp GetFunctions(TGetFunctionsReq req)') + print(' TGetPrimaryKeysResp GetPrimaryKeys(TGetPrimaryKeysReq req)') + print(' TGetCrossReferenceResp GetCrossReference(TGetCrossReferenceReq req)') + print(' TGetOperationStatusResp GetOperationStatus(TGetOperationStatusReq req)') + print(' TCancelOperationResp CancelOperation(TCancelOperationReq req)') + print(' TCloseOperationResp CloseOperation(TCloseOperationReq req)') + print(' TGetResultSetMetadataResp GetResultSetMetadata(TGetResultSetMetadataReq req)') + print(' TFetchResultsResp FetchResults(TFetchResultsReq req)') + print(' TGetDelegationTokenResp GetDelegationToken(TGetDelegationTokenReq req)') + print(' TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req)') + print(' TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req)') + print(' TGetLogResp GetLog(TGetLogReq req)') + print('') + sys.exit(0) + +pp = pprint.PrettyPrinter(indent=2) +host = 'localhost' +port = 9090 +uri = '' +framed = False +ssl = False +validate = True +ca_certs = None +keyfile = None +certfile = None +http = False +argi = 1 + +if sys.argv[argi] == '-h': + parts = sys.argv[argi + 1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + argi += 2 + +if sys.argv[argi] == '-u': + url = urlparse(sys.argv[argi + 1]) + parts = url[1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + else: + port = 80 + uri = url[2] + if url[4]: + uri += '?%s' % url[4] + http = True + argi += 2 + +if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': + framed = True + argi += 1 + +if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': + ssl = True + argi += 1 + +if sys.argv[argi] == '-novalidate': + validate = False + argi += 1 + +if sys.argv[argi] == '-ca_certs': + ca_certs = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-keyfile': + keyfile = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-certfile': + certfile = sys.argv[argi+1] + argi += 2 + +cmd = sys.argv[argi] +args = sys.argv[argi + 1:] + +if http: + transport = THttpClient.THttpClient(host, port, uri) +else: + if ssl: + socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile) + else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol(transport) +client = TCLIService.Client(protocol) +transport.open() + +if cmd == 'OpenSession': + if len(args) != 1: + print('OpenSession requires 1 args') + sys.exit(1) + pp.pprint(client.OpenSession(eval(args[0]),)) + +elif cmd == 'CloseSession': + if len(args) != 1: + print('CloseSession requires 1 args') + sys.exit(1) + pp.pprint(client.CloseSession(eval(args[0]),)) + +elif cmd == 'GetInfo': + if len(args) != 1: + print('GetInfo requires 1 args') + sys.exit(1) + pp.pprint(client.GetInfo(eval(args[0]),)) + +elif cmd == 'ExecuteStatement': + if len(args) != 1: + print('ExecuteStatement requires 1 args') + sys.exit(1) + pp.pprint(client.ExecuteStatement(eval(args[0]),)) + +elif cmd == 'GetTypeInfo': + if len(args) != 1: + print('GetTypeInfo requires 1 args') + sys.exit(1) + pp.pprint(client.GetTypeInfo(eval(args[0]),)) + +elif cmd == 'GetCatalogs': + if len(args) != 1: + print('GetCatalogs requires 1 args') + sys.exit(1) + pp.pprint(client.GetCatalogs(eval(args[0]),)) + +elif cmd == 'GetSchemas': + if len(args) != 1: + print('GetSchemas requires 1 args') + sys.exit(1) + pp.pprint(client.GetSchemas(eval(args[0]),)) + +elif cmd == 'GetTables': + if len(args) != 1: + print('GetTables requires 1 args') + sys.exit(1) + pp.pprint(client.GetTables(eval(args[0]),)) + +elif cmd == 'GetTableTypes': + if len(args) != 1: + print('GetTableTypes requires 1 args') + sys.exit(1) + pp.pprint(client.GetTableTypes(eval(args[0]),)) + +elif cmd == 'GetColumns': + if len(args) != 1: + print('GetColumns requires 1 args') + sys.exit(1) + pp.pprint(client.GetColumns(eval(args[0]),)) + +elif cmd == 'GetFunctions': + if len(args) != 1: + print('GetFunctions requires 1 args') + sys.exit(1) + pp.pprint(client.GetFunctions(eval(args[0]),)) + +elif cmd == 'GetPrimaryKeys': + if len(args) != 1: + print('GetPrimaryKeys requires 1 args') + sys.exit(1) + pp.pprint(client.GetPrimaryKeys(eval(args[0]),)) + +elif cmd == 'GetCrossReference': + if len(args) != 1: + print('GetCrossReference requires 1 args') + sys.exit(1) + pp.pprint(client.GetCrossReference(eval(args[0]),)) + +elif cmd == 'GetOperationStatus': + if len(args) != 1: + print('GetOperationStatus requires 1 args') + sys.exit(1) + pp.pprint(client.GetOperationStatus(eval(args[0]),)) + +elif cmd == 'CancelOperation': + if len(args) != 1: + print('CancelOperation requires 1 args') + sys.exit(1) + pp.pprint(client.CancelOperation(eval(args[0]),)) + +elif cmd == 'CloseOperation': + if len(args) != 1: + print('CloseOperation requires 1 args') + sys.exit(1) + pp.pprint(client.CloseOperation(eval(args[0]),)) + +elif cmd == 'GetResultSetMetadata': + if len(args) != 1: + print('GetResultSetMetadata requires 1 args') + sys.exit(1) + pp.pprint(client.GetResultSetMetadata(eval(args[0]),)) + +elif cmd == 'FetchResults': + if len(args) != 1: + print('FetchResults requires 1 args') + sys.exit(1) + pp.pprint(client.FetchResults(eval(args[0]),)) + +elif cmd == 'GetDelegationToken': + if len(args) != 1: + print('GetDelegationToken requires 1 args') + sys.exit(1) + pp.pprint(client.GetDelegationToken(eval(args[0]),)) + +elif cmd == 'CancelDelegationToken': + if len(args) != 1: + print('CancelDelegationToken requires 1 args') + sys.exit(1) + pp.pprint(client.CancelDelegationToken(eval(args[0]),)) + +elif cmd == 'RenewDelegationToken': + if len(args) != 1: + print('RenewDelegationToken requires 1 args') + sys.exit(1) + pp.pprint(client.RenewDelegationToken(eval(args[0]),)) + +elif cmd == 'GetLog': + if len(args) != 1: + print('GetLog requires 1 args') + sys.exit(1) + pp.pprint(client.GetLog(eval(args[0]),)) + +else: + print('Unrecognized method %s' % cmd) + sys.exit(1) + +transport.close() diff --git a/src/chronify/_vendor/kyuubi/TCLIService/TCLIService.py b/src/chronify/_vendor/kyuubi/TCLIService/TCLIService.py new file mode 100644 index 0000000..bb1415e --- /dev/null +++ b/src/chronify/_vendor/kyuubi/TCLIService/TCLIService.py @@ -0,0 +1,3986 @@ +# +# Autogenerated by Thrift Compiler (0.10.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +import sys +import logging +from .ttypes import * +from thrift.Thrift import TProcessor +from thrift.transport import TTransport + + +class Iface(object): + def OpenSession(self, req): + """ + Parameters: + - req + """ + pass + + def CloseSession(self, req): + """ + Parameters: + - req + """ + pass + + def GetInfo(self, req): + """ + Parameters: + - req + """ + pass + + def ExecuteStatement(self, req): + """ + Parameters: + - req + """ + pass + + def GetTypeInfo(self, req): + """ + Parameters: + - req + """ + pass + + def GetCatalogs(self, req): + """ + Parameters: + - req + """ + pass + + def GetSchemas(self, req): + """ + Parameters: + - req + """ + pass + + def GetTables(self, req): + """ + Parameters: + - req + """ + pass + + def GetTableTypes(self, req): + """ + Parameters: + - req + """ + pass + + def GetColumns(self, req): + """ + Parameters: + - req + """ + pass + + def GetFunctions(self, req): + """ + Parameters: + - req + """ + pass + + def GetPrimaryKeys(self, req): + """ + Parameters: + - req + """ + pass + + def GetCrossReference(self, req): + """ + Parameters: + - req + """ + pass + + def GetOperationStatus(self, req): + """ + Parameters: + - req + """ + pass + + def CancelOperation(self, req): + """ + Parameters: + - req + """ + pass + + def CloseOperation(self, req): + """ + Parameters: + - req + """ + pass + + def GetResultSetMetadata(self, req): + """ + Parameters: + - req + """ + pass + + def FetchResults(self, req): + """ + Parameters: + - req + """ + pass + + def GetDelegationToken(self, req): + """ + Parameters: + - req + """ + pass + + def CancelDelegationToken(self, req): + """ + Parameters: + - req + """ + pass + + def RenewDelegationToken(self, req): + """ + Parameters: + - req + """ + pass + + def GetLog(self, req): + """ + Parameters: + - req + """ + pass + + +class Client(Iface): + def __init__(self, iprot, oprot=None): + self._iprot = self._oprot = iprot + if oprot is not None: + self._oprot = oprot + self._seqid = 0 + + def OpenSession(self, req): + """ + Parameters: + - req + """ + self.send_OpenSession(req) + return self.recv_OpenSession() + + def send_OpenSession(self, req): + self._oprot.writeMessageBegin('OpenSession', TMessageType.CALL, self._seqid) + args = OpenSession_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_OpenSession(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = OpenSession_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "OpenSession failed: unknown result") + + def CloseSession(self, req): + """ + Parameters: + - req + """ + self.send_CloseSession(req) + return self.recv_CloseSession() + + def send_CloseSession(self, req): + self._oprot.writeMessageBegin('CloseSession', TMessageType.CALL, self._seqid) + args = CloseSession_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_CloseSession(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = CloseSession_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "CloseSession failed: unknown result") + + def GetInfo(self, req): + """ + Parameters: + - req + """ + self.send_GetInfo(req) + return self.recv_GetInfo() + + def send_GetInfo(self, req): + self._oprot.writeMessageBegin('GetInfo', TMessageType.CALL, self._seqid) + args = GetInfo_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetInfo(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetInfo_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetInfo failed: unknown result") + + def ExecuteStatement(self, req): + """ + Parameters: + - req + """ + self.send_ExecuteStatement(req) + return self.recv_ExecuteStatement() + + def send_ExecuteStatement(self, req): + self._oprot.writeMessageBegin('ExecuteStatement', TMessageType.CALL, self._seqid) + args = ExecuteStatement_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_ExecuteStatement(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = ExecuteStatement_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "ExecuteStatement failed: unknown result") + + def GetTypeInfo(self, req): + """ + Parameters: + - req + """ + self.send_GetTypeInfo(req) + return self.recv_GetTypeInfo() + + def send_GetTypeInfo(self, req): + self._oprot.writeMessageBegin('GetTypeInfo', TMessageType.CALL, self._seqid) + args = GetTypeInfo_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetTypeInfo(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetTypeInfo_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetTypeInfo failed: unknown result") + + def GetCatalogs(self, req): + """ + Parameters: + - req + """ + self.send_GetCatalogs(req) + return self.recv_GetCatalogs() + + def send_GetCatalogs(self, req): + self._oprot.writeMessageBegin('GetCatalogs', TMessageType.CALL, self._seqid) + args = GetCatalogs_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetCatalogs(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetCatalogs_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetCatalogs failed: unknown result") + + def GetSchemas(self, req): + """ + Parameters: + - req + """ + self.send_GetSchemas(req) + return self.recv_GetSchemas() + + def send_GetSchemas(self, req): + self._oprot.writeMessageBegin('GetSchemas', TMessageType.CALL, self._seqid) + args = GetSchemas_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetSchemas(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetSchemas_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetSchemas failed: unknown result") + + def GetTables(self, req): + """ + Parameters: + - req + """ + self.send_GetTables(req) + return self.recv_GetTables() + + def send_GetTables(self, req): + self._oprot.writeMessageBegin('GetTables', TMessageType.CALL, self._seqid) + args = GetTables_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetTables(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetTables_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetTables failed: unknown result") + + def GetTableTypes(self, req): + """ + Parameters: + - req + """ + self.send_GetTableTypes(req) + return self.recv_GetTableTypes() + + def send_GetTableTypes(self, req): + self._oprot.writeMessageBegin('GetTableTypes', TMessageType.CALL, self._seqid) + args = GetTableTypes_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetTableTypes(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetTableTypes_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetTableTypes failed: unknown result") + + def GetColumns(self, req): + """ + Parameters: + - req + """ + self.send_GetColumns(req) + return self.recv_GetColumns() + + def send_GetColumns(self, req): + self._oprot.writeMessageBegin('GetColumns', TMessageType.CALL, self._seqid) + args = GetColumns_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetColumns(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetColumns_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetColumns failed: unknown result") + + def GetFunctions(self, req): + """ + Parameters: + - req + """ + self.send_GetFunctions(req) + return self.recv_GetFunctions() + + def send_GetFunctions(self, req): + self._oprot.writeMessageBegin('GetFunctions', TMessageType.CALL, self._seqid) + args = GetFunctions_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetFunctions(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetFunctions_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetFunctions failed: unknown result") + + def GetPrimaryKeys(self, req): + """ + Parameters: + - req + """ + self.send_GetPrimaryKeys(req) + return self.recv_GetPrimaryKeys() + + def send_GetPrimaryKeys(self, req): + self._oprot.writeMessageBegin('GetPrimaryKeys', TMessageType.CALL, self._seqid) + args = GetPrimaryKeys_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetPrimaryKeys(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetPrimaryKeys_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetPrimaryKeys failed: unknown result") + + def GetCrossReference(self, req): + """ + Parameters: + - req + """ + self.send_GetCrossReference(req) + return self.recv_GetCrossReference() + + def send_GetCrossReference(self, req): + self._oprot.writeMessageBegin('GetCrossReference', TMessageType.CALL, self._seqid) + args = GetCrossReference_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetCrossReference(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetCrossReference_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetCrossReference failed: unknown result") + + def GetOperationStatus(self, req): + """ + Parameters: + - req + """ + self.send_GetOperationStatus(req) + return self.recv_GetOperationStatus() + + def send_GetOperationStatus(self, req): + self._oprot.writeMessageBegin('GetOperationStatus', TMessageType.CALL, self._seqid) + args = GetOperationStatus_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetOperationStatus(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetOperationStatus_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetOperationStatus failed: unknown result") + + def CancelOperation(self, req): + """ + Parameters: + - req + """ + self.send_CancelOperation(req) + return self.recv_CancelOperation() + + def send_CancelOperation(self, req): + self._oprot.writeMessageBegin('CancelOperation', TMessageType.CALL, self._seqid) + args = CancelOperation_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_CancelOperation(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = CancelOperation_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "CancelOperation failed: unknown result") + + def CloseOperation(self, req): + """ + Parameters: + - req + """ + self.send_CloseOperation(req) + return self.recv_CloseOperation() + + def send_CloseOperation(self, req): + self._oprot.writeMessageBegin('CloseOperation', TMessageType.CALL, self._seqid) + args = CloseOperation_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_CloseOperation(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = CloseOperation_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "CloseOperation failed: unknown result") + + def GetResultSetMetadata(self, req): + """ + Parameters: + - req + """ + self.send_GetResultSetMetadata(req) + return self.recv_GetResultSetMetadata() + + def send_GetResultSetMetadata(self, req): + self._oprot.writeMessageBegin('GetResultSetMetadata', TMessageType.CALL, self._seqid) + args = GetResultSetMetadata_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetResultSetMetadata(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetResultSetMetadata_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetResultSetMetadata failed: unknown result") + + def FetchResults(self, req): + """ + Parameters: + - req + """ + self.send_FetchResults(req) + return self.recv_FetchResults() + + def send_FetchResults(self, req): + self._oprot.writeMessageBegin('FetchResults', TMessageType.CALL, self._seqid) + args = FetchResults_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_FetchResults(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = FetchResults_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "FetchResults failed: unknown result") + + def GetDelegationToken(self, req): + """ + Parameters: + - req + """ + self.send_GetDelegationToken(req) + return self.recv_GetDelegationToken() + + def send_GetDelegationToken(self, req): + self._oprot.writeMessageBegin('GetDelegationToken', TMessageType.CALL, self._seqid) + args = GetDelegationToken_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetDelegationToken(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetDelegationToken_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetDelegationToken failed: unknown result") + + def CancelDelegationToken(self, req): + """ + Parameters: + - req + """ + self.send_CancelDelegationToken(req) + return self.recv_CancelDelegationToken() + + def send_CancelDelegationToken(self, req): + self._oprot.writeMessageBegin('CancelDelegationToken', TMessageType.CALL, self._seqid) + args = CancelDelegationToken_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_CancelDelegationToken(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = CancelDelegationToken_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "CancelDelegationToken failed: unknown result") + + def RenewDelegationToken(self, req): + """ + Parameters: + - req + """ + self.send_RenewDelegationToken(req) + return self.recv_RenewDelegationToken() + + def send_RenewDelegationToken(self, req): + self._oprot.writeMessageBegin('RenewDelegationToken', TMessageType.CALL, self._seqid) + args = RenewDelegationToken_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_RenewDelegationToken(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = RenewDelegationToken_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "RenewDelegationToken failed: unknown result") + + def GetLog(self, req): + """ + Parameters: + - req + """ + self.send_GetLog(req) + return self.recv_GetLog() + + def send_GetLog(self, req): + self._oprot.writeMessageBegin('GetLog', TMessageType.CALL, self._seqid) + args = GetLog_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_GetLog(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = GetLog_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "GetLog failed: unknown result") + + +class Processor(Iface, TProcessor): + def __init__(self, handler): + self._handler = handler + self._processMap = {} + self._processMap["OpenSession"] = Processor.process_OpenSession + self._processMap["CloseSession"] = Processor.process_CloseSession + self._processMap["GetInfo"] = Processor.process_GetInfo + self._processMap["ExecuteStatement"] = Processor.process_ExecuteStatement + self._processMap["GetTypeInfo"] = Processor.process_GetTypeInfo + self._processMap["GetCatalogs"] = Processor.process_GetCatalogs + self._processMap["GetSchemas"] = Processor.process_GetSchemas + self._processMap["GetTables"] = Processor.process_GetTables + self._processMap["GetTableTypes"] = Processor.process_GetTableTypes + self._processMap["GetColumns"] = Processor.process_GetColumns + self._processMap["GetFunctions"] = Processor.process_GetFunctions + self._processMap["GetPrimaryKeys"] = Processor.process_GetPrimaryKeys + self._processMap["GetCrossReference"] = Processor.process_GetCrossReference + self._processMap["GetOperationStatus"] = Processor.process_GetOperationStatus + self._processMap["CancelOperation"] = Processor.process_CancelOperation + self._processMap["CloseOperation"] = Processor.process_CloseOperation + self._processMap["GetResultSetMetadata"] = Processor.process_GetResultSetMetadata + self._processMap["FetchResults"] = Processor.process_FetchResults + self._processMap["GetDelegationToken"] = Processor.process_GetDelegationToken + self._processMap["CancelDelegationToken"] = Processor.process_CancelDelegationToken + self._processMap["RenewDelegationToken"] = Processor.process_RenewDelegationToken + self._processMap["GetLog"] = Processor.process_GetLog + + def process(self, iprot, oprot): + (name, type, seqid) = iprot.readMessageBegin() + if name not in self._processMap: + iprot.skip(TType.STRUCT) + iprot.readMessageEnd() + x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) + oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) + x.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + return + else: + self._processMap[name](self, seqid, iprot, oprot) + return True + + def process_OpenSession(self, seqid, iprot, oprot): + args = OpenSession_args() + args.read(iprot) + iprot.readMessageEnd() + result = OpenSession_result() + try: + result.success = self._handler.OpenSession(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("OpenSession", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_CloseSession(self, seqid, iprot, oprot): + args = CloseSession_args() + args.read(iprot) + iprot.readMessageEnd() + result = CloseSession_result() + try: + result.success = self._handler.CloseSession(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("CloseSession", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetInfo(self, seqid, iprot, oprot): + args = GetInfo_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetInfo_result() + try: + result.success = self._handler.GetInfo(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetInfo", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_ExecuteStatement(self, seqid, iprot, oprot): + args = ExecuteStatement_args() + args.read(iprot) + iprot.readMessageEnd() + result = ExecuteStatement_result() + try: + result.success = self._handler.ExecuteStatement(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("ExecuteStatement", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetTypeInfo(self, seqid, iprot, oprot): + args = GetTypeInfo_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetTypeInfo_result() + try: + result.success = self._handler.GetTypeInfo(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetTypeInfo", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetCatalogs(self, seqid, iprot, oprot): + args = GetCatalogs_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetCatalogs_result() + try: + result.success = self._handler.GetCatalogs(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetCatalogs", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetSchemas(self, seqid, iprot, oprot): + args = GetSchemas_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetSchemas_result() + try: + result.success = self._handler.GetSchemas(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetSchemas", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetTables(self, seqid, iprot, oprot): + args = GetTables_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetTables_result() + try: + result.success = self._handler.GetTables(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetTables", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetTableTypes(self, seqid, iprot, oprot): + args = GetTableTypes_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetTableTypes_result() + try: + result.success = self._handler.GetTableTypes(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetTableTypes", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetColumns(self, seqid, iprot, oprot): + args = GetColumns_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetColumns_result() + try: + result.success = self._handler.GetColumns(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetColumns", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetFunctions(self, seqid, iprot, oprot): + args = GetFunctions_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetFunctions_result() + try: + result.success = self._handler.GetFunctions(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetFunctions", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetPrimaryKeys(self, seqid, iprot, oprot): + args = GetPrimaryKeys_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetPrimaryKeys_result() + try: + result.success = self._handler.GetPrimaryKeys(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetPrimaryKeys", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetCrossReference(self, seqid, iprot, oprot): + args = GetCrossReference_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetCrossReference_result() + try: + result.success = self._handler.GetCrossReference(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetCrossReference", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetOperationStatus(self, seqid, iprot, oprot): + args = GetOperationStatus_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetOperationStatus_result() + try: + result.success = self._handler.GetOperationStatus(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetOperationStatus", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_CancelOperation(self, seqid, iprot, oprot): + args = CancelOperation_args() + args.read(iprot) + iprot.readMessageEnd() + result = CancelOperation_result() + try: + result.success = self._handler.CancelOperation(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("CancelOperation", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_CloseOperation(self, seqid, iprot, oprot): + args = CloseOperation_args() + args.read(iprot) + iprot.readMessageEnd() + result = CloseOperation_result() + try: + result.success = self._handler.CloseOperation(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("CloseOperation", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetResultSetMetadata(self, seqid, iprot, oprot): + args = GetResultSetMetadata_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetResultSetMetadata_result() + try: + result.success = self._handler.GetResultSetMetadata(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetResultSetMetadata", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_FetchResults(self, seqid, iprot, oprot): + args = FetchResults_args() + args.read(iprot) + iprot.readMessageEnd() + result = FetchResults_result() + try: + result.success = self._handler.FetchResults(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("FetchResults", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetDelegationToken(self, seqid, iprot, oprot): + args = GetDelegationToken_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetDelegationToken_result() + try: + result.success = self._handler.GetDelegationToken(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetDelegationToken", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_CancelDelegationToken(self, seqid, iprot, oprot): + args = CancelDelegationToken_args() + args.read(iprot) + iprot.readMessageEnd() + result = CancelDelegationToken_result() + try: + result.success = self._handler.CancelDelegationToken(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("CancelDelegationToken", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_RenewDelegationToken(self, seqid, iprot, oprot): + args = RenewDelegationToken_args() + args.read(iprot) + iprot.readMessageEnd() + result = RenewDelegationToken_result() + try: + result.success = self._handler.RenewDelegationToken(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("RenewDelegationToken", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_GetLog(self, seqid, iprot, oprot): + args = GetLog_args() + args.read(iprot) + iprot.readMessageEnd() + result = GetLog_result() + try: + result.success = self._handler.GetLog(args.req) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("GetLog", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + +# HELPER FUNCTIONS AND STRUCTURES + + +class OpenSession_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TOpenSessionReq, TOpenSessionReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TOpenSessionReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('OpenSession_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class OpenSession_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TOpenSessionResp, TOpenSessionResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TOpenSessionResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('OpenSession_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CloseSession_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TCloseSessionReq, TCloseSessionReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TCloseSessionReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CloseSession_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CloseSession_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TCloseSessionResp, TCloseSessionResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TCloseSessionResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CloseSession_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetInfo_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetInfoReq, TGetInfoReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetInfoReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetInfo_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetInfo_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetInfoResp, TGetInfoResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetInfoResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetInfo_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class ExecuteStatement_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TExecuteStatementReq, TExecuteStatementReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TExecuteStatementReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ExecuteStatement_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class ExecuteStatement_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TExecuteStatementResp, TExecuteStatementResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TExecuteStatementResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ExecuteStatement_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetTypeInfo_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetTypeInfoReq, TGetTypeInfoReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetTypeInfoReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetTypeInfo_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetTypeInfo_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetTypeInfoResp, TGetTypeInfoResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetTypeInfoResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetTypeInfo_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetCatalogs_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetCatalogsReq, TGetCatalogsReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetCatalogsReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetCatalogs_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetCatalogs_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetCatalogsResp, TGetCatalogsResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetCatalogsResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetCatalogs_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetSchemas_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetSchemasReq, TGetSchemasReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetSchemasReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetSchemas_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetSchemas_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetSchemasResp, TGetSchemasResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetSchemasResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetSchemas_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetTables_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetTablesReq, TGetTablesReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetTablesReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetTables_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetTables_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetTablesResp, TGetTablesResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetTablesResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetTables_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetTableTypes_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetTableTypesReq, TGetTableTypesReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetTableTypesReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetTableTypes_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetTableTypes_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetTableTypesResp, TGetTableTypesResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetTableTypesResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetTableTypes_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetColumns_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetColumnsReq, TGetColumnsReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetColumnsReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetColumns_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetColumns_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetColumnsResp, TGetColumnsResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetColumnsResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetColumns_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetFunctions_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetFunctionsReq, TGetFunctionsReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetFunctionsReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetFunctions_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetFunctions_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetFunctionsResp, TGetFunctionsResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetFunctionsResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetFunctions_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetPrimaryKeys_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetPrimaryKeysReq, TGetPrimaryKeysReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetPrimaryKeysReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetPrimaryKeys_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetPrimaryKeys_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetPrimaryKeysResp, TGetPrimaryKeysResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetPrimaryKeysResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetPrimaryKeys_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetCrossReference_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetCrossReferenceReq, TGetCrossReferenceReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetCrossReferenceReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetCrossReference_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetCrossReference_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetCrossReferenceResp, TGetCrossReferenceResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetCrossReferenceResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetCrossReference_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetOperationStatus_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetOperationStatusReq, TGetOperationStatusReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetOperationStatusReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetOperationStatus_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetOperationStatus_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetOperationStatusResp, TGetOperationStatusResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetOperationStatusResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetOperationStatus_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CancelOperation_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TCancelOperationReq, TCancelOperationReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TCancelOperationReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CancelOperation_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CancelOperation_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TCancelOperationResp, TCancelOperationResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TCancelOperationResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CancelOperation_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CloseOperation_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TCloseOperationReq, TCloseOperationReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TCloseOperationReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CloseOperation_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CloseOperation_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TCloseOperationResp, TCloseOperationResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TCloseOperationResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CloseOperation_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetResultSetMetadata_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetResultSetMetadataReq, TGetResultSetMetadataReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetResultSetMetadataReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetResultSetMetadata_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetResultSetMetadata_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetResultSetMetadataResp, TGetResultSetMetadataResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetResultSetMetadataResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetResultSetMetadata_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class FetchResults_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TFetchResultsReq, TFetchResultsReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TFetchResultsReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('FetchResults_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class FetchResults_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TFetchResultsResp, TFetchResultsResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TFetchResultsResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('FetchResults_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetDelegationToken_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetDelegationTokenReq, TGetDelegationTokenReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetDelegationTokenReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetDelegationToken_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetDelegationToken_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetDelegationTokenResp, TGetDelegationTokenResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetDelegationTokenResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetDelegationToken_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CancelDelegationToken_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TCancelDelegationTokenReq, TCancelDelegationTokenReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TCancelDelegationTokenReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CancelDelegationToken_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class CancelDelegationToken_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TCancelDelegationTokenResp, TCancelDelegationTokenResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TCancelDelegationTokenResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('CancelDelegationToken_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class RenewDelegationToken_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TRenewDelegationTokenReq, TRenewDelegationTokenReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TRenewDelegationTokenReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('RenewDelegationToken_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class RenewDelegationToken_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TRenewDelegationTokenResp, TRenewDelegationTokenResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TRenewDelegationTokenResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('RenewDelegationToken_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetLog_args(object): + """ + Attributes: + - req + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', (TGetLogReq, TGetLogReq.thrift_spec), None, ), # 1 + ) + + def __init__(self, req=None,): + self.req = req + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = TGetLogReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetLog_args') + if self.req is not None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class GetLog_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (TGetLogResp, TGetLogResp.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = TGetLogResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('GetLog_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) diff --git a/src/chronify/_vendor/kyuubi/TCLIService/__init__.py b/src/chronify/_vendor/kyuubi/TCLIService/__init__.py new file mode 100644 index 0000000..fe5e7c2 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/TCLIService/__init__.py @@ -0,0 +1 @@ +__all__ = ['ttypes', 'constants', 'TCLIService'] diff --git a/src/chronify/_vendor/kyuubi/TCLIService/constants.py b/src/chronify/_vendor/kyuubi/TCLIService/constants.py new file mode 100644 index 0000000..b6bf88e --- /dev/null +++ b/src/chronify/_vendor/kyuubi/TCLIService/constants.py @@ -0,0 +1,68 @@ +# +# Autogenerated by Thrift Compiler (0.10.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +import sys +from .ttypes import * +PRIMITIVE_TYPES = set(( + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 15, + 16, + 17, + 18, + 19, + 20, + 21, +)) +COMPLEX_TYPES = set(( + 10, + 11, + 12, + 13, + 14, +)) +COLLECTION_TYPES = set(( + 10, + 11, +)) +TYPE_NAMES = { + 0: "BOOLEAN", + 1: "TINYINT", + 2: "SMALLINT", + 3: "INT", + 4: "BIGINT", + 5: "FLOAT", + 6: "DOUBLE", + 7: "STRING", + 8: "TIMESTAMP", + 9: "BINARY", + 10: "ARRAY", + 11: "MAP", + 12: "STRUCT", + 13: "UNIONTYPE", + 15: "DECIMAL", + 16: "NULL", + 17: "DATE", + 18: "VARCHAR", + 19: "CHAR", + 20: "INTERVAL_YEAR_MONTH", + 21: "INTERVAL_DAY_TIME", +} +CHARACTER_MAXIMUM_LENGTH = "characterMaximumLength" +PRECISION = "precision" +SCALE = "scale" diff --git a/src/chronify/_vendor/kyuubi/TCLIService/ttypes.py b/src/chronify/_vendor/kyuubi/TCLIService/ttypes.py new file mode 100644 index 0000000..573bd04 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/TCLIService/ttypes.py @@ -0,0 +1,7210 @@ +# +# Autogenerated by Thrift Compiler (0.10.0) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +import sys + +from thrift.transport import TTransport + + +class TProtocolVersion(object): + HIVE_CLI_SERVICE_PROTOCOL_V1 = 0 + HIVE_CLI_SERVICE_PROTOCOL_V2 = 1 + HIVE_CLI_SERVICE_PROTOCOL_V3 = 2 + HIVE_CLI_SERVICE_PROTOCOL_V4 = 3 + HIVE_CLI_SERVICE_PROTOCOL_V5 = 4 + HIVE_CLI_SERVICE_PROTOCOL_V6 = 5 + HIVE_CLI_SERVICE_PROTOCOL_V7 = 6 + HIVE_CLI_SERVICE_PROTOCOL_V8 = 7 + HIVE_CLI_SERVICE_PROTOCOL_V9 = 8 + HIVE_CLI_SERVICE_PROTOCOL_V10 = 9 + + _VALUES_TO_NAMES = { + 0: "HIVE_CLI_SERVICE_PROTOCOL_V1", + 1: "HIVE_CLI_SERVICE_PROTOCOL_V2", + 2: "HIVE_CLI_SERVICE_PROTOCOL_V3", + 3: "HIVE_CLI_SERVICE_PROTOCOL_V4", + 4: "HIVE_CLI_SERVICE_PROTOCOL_V5", + 5: "HIVE_CLI_SERVICE_PROTOCOL_V6", + 6: "HIVE_CLI_SERVICE_PROTOCOL_V7", + 7: "HIVE_CLI_SERVICE_PROTOCOL_V8", + 8: "HIVE_CLI_SERVICE_PROTOCOL_V9", + 9: "HIVE_CLI_SERVICE_PROTOCOL_V10", + } + + _NAMES_TO_VALUES = { + "HIVE_CLI_SERVICE_PROTOCOL_V1": 0, + "HIVE_CLI_SERVICE_PROTOCOL_V2": 1, + "HIVE_CLI_SERVICE_PROTOCOL_V3": 2, + "HIVE_CLI_SERVICE_PROTOCOL_V4": 3, + "HIVE_CLI_SERVICE_PROTOCOL_V5": 4, + "HIVE_CLI_SERVICE_PROTOCOL_V6": 5, + "HIVE_CLI_SERVICE_PROTOCOL_V7": 6, + "HIVE_CLI_SERVICE_PROTOCOL_V8": 7, + "HIVE_CLI_SERVICE_PROTOCOL_V9": 8, + "HIVE_CLI_SERVICE_PROTOCOL_V10": 9, + } + + +class TTypeId(object): + BOOLEAN_TYPE = 0 + TINYINT_TYPE = 1 + SMALLINT_TYPE = 2 + INT_TYPE = 3 + BIGINT_TYPE = 4 + FLOAT_TYPE = 5 + DOUBLE_TYPE = 6 + STRING_TYPE = 7 + TIMESTAMP_TYPE = 8 + BINARY_TYPE = 9 + ARRAY_TYPE = 10 + MAP_TYPE = 11 + STRUCT_TYPE = 12 + UNION_TYPE = 13 + USER_DEFINED_TYPE = 14 + DECIMAL_TYPE = 15 + NULL_TYPE = 16 + DATE_TYPE = 17 + VARCHAR_TYPE = 18 + CHAR_TYPE = 19 + INTERVAL_YEAR_MONTH_TYPE = 20 + INTERVAL_DAY_TIME_TYPE = 21 + + _VALUES_TO_NAMES = { + 0: "BOOLEAN_TYPE", + 1: "TINYINT_TYPE", + 2: "SMALLINT_TYPE", + 3: "INT_TYPE", + 4: "BIGINT_TYPE", + 5: "FLOAT_TYPE", + 6: "DOUBLE_TYPE", + 7: "STRING_TYPE", + 8: "TIMESTAMP_TYPE", + 9: "BINARY_TYPE", + 10: "ARRAY_TYPE", + 11: "MAP_TYPE", + 12: "STRUCT_TYPE", + 13: "UNION_TYPE", + 14: "USER_DEFINED_TYPE", + 15: "DECIMAL_TYPE", + 16: "NULL_TYPE", + 17: "DATE_TYPE", + 18: "VARCHAR_TYPE", + 19: "CHAR_TYPE", + 20: "INTERVAL_YEAR_MONTH_TYPE", + 21: "INTERVAL_DAY_TIME_TYPE", + } + + _NAMES_TO_VALUES = { + "BOOLEAN_TYPE": 0, + "TINYINT_TYPE": 1, + "SMALLINT_TYPE": 2, + "INT_TYPE": 3, + "BIGINT_TYPE": 4, + "FLOAT_TYPE": 5, + "DOUBLE_TYPE": 6, + "STRING_TYPE": 7, + "TIMESTAMP_TYPE": 8, + "BINARY_TYPE": 9, + "ARRAY_TYPE": 10, + "MAP_TYPE": 11, + "STRUCT_TYPE": 12, + "UNION_TYPE": 13, + "USER_DEFINED_TYPE": 14, + "DECIMAL_TYPE": 15, + "NULL_TYPE": 16, + "DATE_TYPE": 17, + "VARCHAR_TYPE": 18, + "CHAR_TYPE": 19, + "INTERVAL_YEAR_MONTH_TYPE": 20, + "INTERVAL_DAY_TIME_TYPE": 21, + } + + +class TStatusCode(object): + SUCCESS_STATUS = 0 + SUCCESS_WITH_INFO_STATUS = 1 + STILL_EXECUTING_STATUS = 2 + ERROR_STATUS = 3 + INVALID_HANDLE_STATUS = 4 + + _VALUES_TO_NAMES = { + 0: "SUCCESS_STATUS", + 1: "SUCCESS_WITH_INFO_STATUS", + 2: "STILL_EXECUTING_STATUS", + 3: "ERROR_STATUS", + 4: "INVALID_HANDLE_STATUS", + } + + _NAMES_TO_VALUES = { + "SUCCESS_STATUS": 0, + "SUCCESS_WITH_INFO_STATUS": 1, + "STILL_EXECUTING_STATUS": 2, + "ERROR_STATUS": 3, + "INVALID_HANDLE_STATUS": 4, + } + + +class TOperationState(object): + INITIALIZED_STATE = 0 + RUNNING_STATE = 1 + FINISHED_STATE = 2 + CANCELED_STATE = 3 + CLOSED_STATE = 4 + ERROR_STATE = 5 + UKNOWN_STATE = 6 + PENDING_STATE = 7 + TIMEDOUT_STATE = 8 + + _VALUES_TO_NAMES = { + 0: "INITIALIZED_STATE", + 1: "RUNNING_STATE", + 2: "FINISHED_STATE", + 3: "CANCELED_STATE", + 4: "CLOSED_STATE", + 5: "ERROR_STATE", + 6: "UKNOWN_STATE", + 7: "PENDING_STATE", + 8: "TIMEDOUT_STATE", + } + + _NAMES_TO_VALUES = { + "INITIALIZED_STATE": 0, + "RUNNING_STATE": 1, + "FINISHED_STATE": 2, + "CANCELED_STATE": 3, + "CLOSED_STATE": 4, + "ERROR_STATE": 5, + "UKNOWN_STATE": 6, + "PENDING_STATE": 7, + "TIMEDOUT_STATE": 8, + } + + +class TOperationType(object): + EXECUTE_STATEMENT = 0 + GET_TYPE_INFO = 1 + GET_CATALOGS = 2 + GET_SCHEMAS = 3 + GET_TABLES = 4 + GET_TABLE_TYPES = 5 + GET_COLUMNS = 6 + GET_FUNCTIONS = 7 + UNKNOWN = 8 + + _VALUES_TO_NAMES = { + 0: "EXECUTE_STATEMENT", + 1: "GET_TYPE_INFO", + 2: "GET_CATALOGS", + 3: "GET_SCHEMAS", + 4: "GET_TABLES", + 5: "GET_TABLE_TYPES", + 6: "GET_COLUMNS", + 7: "GET_FUNCTIONS", + 8: "UNKNOWN", + } + + _NAMES_TO_VALUES = { + "EXECUTE_STATEMENT": 0, + "GET_TYPE_INFO": 1, + "GET_CATALOGS": 2, + "GET_SCHEMAS": 3, + "GET_TABLES": 4, + "GET_TABLE_TYPES": 5, + "GET_COLUMNS": 6, + "GET_FUNCTIONS": 7, + "UNKNOWN": 8, + } + + +class TGetInfoType(object): + CLI_MAX_DRIVER_CONNECTIONS = 0 + CLI_MAX_CONCURRENT_ACTIVITIES = 1 + CLI_DATA_SOURCE_NAME = 2 + CLI_FETCH_DIRECTION = 8 + CLI_SERVER_NAME = 13 + CLI_SEARCH_PATTERN_ESCAPE = 14 + CLI_DBMS_NAME = 17 + CLI_DBMS_VER = 18 + CLI_ACCESSIBLE_TABLES = 19 + CLI_ACCESSIBLE_PROCEDURES = 20 + CLI_CURSOR_COMMIT_BEHAVIOR = 23 + CLI_DATA_SOURCE_READ_ONLY = 25 + CLI_DEFAULT_TXN_ISOLATION = 26 + CLI_IDENTIFIER_CASE = 28 + CLI_IDENTIFIER_QUOTE_CHAR = 29 + CLI_MAX_COLUMN_NAME_LEN = 30 + CLI_MAX_CURSOR_NAME_LEN = 31 + CLI_MAX_SCHEMA_NAME_LEN = 32 + CLI_MAX_CATALOG_NAME_LEN = 34 + CLI_MAX_TABLE_NAME_LEN = 35 + CLI_SCROLL_CONCURRENCY = 43 + CLI_TXN_CAPABLE = 46 + CLI_USER_NAME = 47 + CLI_TXN_ISOLATION_OPTION = 72 + CLI_INTEGRITY = 73 + CLI_GETDATA_EXTENSIONS = 81 + CLI_NULL_COLLATION = 85 + CLI_ALTER_TABLE = 86 + CLI_ORDER_BY_COLUMNS_IN_SELECT = 90 + CLI_SPECIAL_CHARACTERS = 94 + CLI_MAX_COLUMNS_IN_GROUP_BY = 97 + CLI_MAX_COLUMNS_IN_INDEX = 98 + CLI_MAX_COLUMNS_IN_ORDER_BY = 99 + CLI_MAX_COLUMNS_IN_SELECT = 100 + CLI_MAX_COLUMNS_IN_TABLE = 101 + CLI_MAX_INDEX_SIZE = 102 + CLI_MAX_ROW_SIZE = 104 + CLI_MAX_STATEMENT_LEN = 105 + CLI_MAX_TABLES_IN_SELECT = 106 + CLI_MAX_USER_NAME_LEN = 107 + CLI_OJ_CAPABILITIES = 115 + CLI_XOPEN_CLI_YEAR = 10000 + CLI_CURSOR_SENSITIVITY = 10001 + CLI_DESCRIBE_PARAMETER = 10002 + CLI_CATALOG_NAME = 10003 + CLI_COLLATION_SEQ = 10004 + CLI_MAX_IDENTIFIER_LEN = 10005 + + _VALUES_TO_NAMES = { + 0: "CLI_MAX_DRIVER_CONNECTIONS", + 1: "CLI_MAX_CONCURRENT_ACTIVITIES", + 2: "CLI_DATA_SOURCE_NAME", + 8: "CLI_FETCH_DIRECTION", + 13: "CLI_SERVER_NAME", + 14: "CLI_SEARCH_PATTERN_ESCAPE", + 17: "CLI_DBMS_NAME", + 18: "CLI_DBMS_VER", + 19: "CLI_ACCESSIBLE_TABLES", + 20: "CLI_ACCESSIBLE_PROCEDURES", + 23: "CLI_CURSOR_COMMIT_BEHAVIOR", + 25: "CLI_DATA_SOURCE_READ_ONLY", + 26: "CLI_DEFAULT_TXN_ISOLATION", + 28: "CLI_IDENTIFIER_CASE", + 29: "CLI_IDENTIFIER_QUOTE_CHAR", + 30: "CLI_MAX_COLUMN_NAME_LEN", + 31: "CLI_MAX_CURSOR_NAME_LEN", + 32: "CLI_MAX_SCHEMA_NAME_LEN", + 34: "CLI_MAX_CATALOG_NAME_LEN", + 35: "CLI_MAX_TABLE_NAME_LEN", + 43: "CLI_SCROLL_CONCURRENCY", + 46: "CLI_TXN_CAPABLE", + 47: "CLI_USER_NAME", + 72: "CLI_TXN_ISOLATION_OPTION", + 73: "CLI_INTEGRITY", + 81: "CLI_GETDATA_EXTENSIONS", + 85: "CLI_NULL_COLLATION", + 86: "CLI_ALTER_TABLE", + 90: "CLI_ORDER_BY_COLUMNS_IN_SELECT", + 94: "CLI_SPECIAL_CHARACTERS", + 97: "CLI_MAX_COLUMNS_IN_GROUP_BY", + 98: "CLI_MAX_COLUMNS_IN_INDEX", + 99: "CLI_MAX_COLUMNS_IN_ORDER_BY", + 100: "CLI_MAX_COLUMNS_IN_SELECT", + 101: "CLI_MAX_COLUMNS_IN_TABLE", + 102: "CLI_MAX_INDEX_SIZE", + 104: "CLI_MAX_ROW_SIZE", + 105: "CLI_MAX_STATEMENT_LEN", + 106: "CLI_MAX_TABLES_IN_SELECT", + 107: "CLI_MAX_USER_NAME_LEN", + 115: "CLI_OJ_CAPABILITIES", + 10000: "CLI_XOPEN_CLI_YEAR", + 10001: "CLI_CURSOR_SENSITIVITY", + 10002: "CLI_DESCRIBE_PARAMETER", + 10003: "CLI_CATALOG_NAME", + 10004: "CLI_COLLATION_SEQ", + 10005: "CLI_MAX_IDENTIFIER_LEN", + } + + _NAMES_TO_VALUES = { + "CLI_MAX_DRIVER_CONNECTIONS": 0, + "CLI_MAX_CONCURRENT_ACTIVITIES": 1, + "CLI_DATA_SOURCE_NAME": 2, + "CLI_FETCH_DIRECTION": 8, + "CLI_SERVER_NAME": 13, + "CLI_SEARCH_PATTERN_ESCAPE": 14, + "CLI_DBMS_NAME": 17, + "CLI_DBMS_VER": 18, + "CLI_ACCESSIBLE_TABLES": 19, + "CLI_ACCESSIBLE_PROCEDURES": 20, + "CLI_CURSOR_COMMIT_BEHAVIOR": 23, + "CLI_DATA_SOURCE_READ_ONLY": 25, + "CLI_DEFAULT_TXN_ISOLATION": 26, + "CLI_IDENTIFIER_CASE": 28, + "CLI_IDENTIFIER_QUOTE_CHAR": 29, + "CLI_MAX_COLUMN_NAME_LEN": 30, + "CLI_MAX_CURSOR_NAME_LEN": 31, + "CLI_MAX_SCHEMA_NAME_LEN": 32, + "CLI_MAX_CATALOG_NAME_LEN": 34, + "CLI_MAX_TABLE_NAME_LEN": 35, + "CLI_SCROLL_CONCURRENCY": 43, + "CLI_TXN_CAPABLE": 46, + "CLI_USER_NAME": 47, + "CLI_TXN_ISOLATION_OPTION": 72, + "CLI_INTEGRITY": 73, + "CLI_GETDATA_EXTENSIONS": 81, + "CLI_NULL_COLLATION": 85, + "CLI_ALTER_TABLE": 86, + "CLI_ORDER_BY_COLUMNS_IN_SELECT": 90, + "CLI_SPECIAL_CHARACTERS": 94, + "CLI_MAX_COLUMNS_IN_GROUP_BY": 97, + "CLI_MAX_COLUMNS_IN_INDEX": 98, + "CLI_MAX_COLUMNS_IN_ORDER_BY": 99, + "CLI_MAX_COLUMNS_IN_SELECT": 100, + "CLI_MAX_COLUMNS_IN_TABLE": 101, + "CLI_MAX_INDEX_SIZE": 102, + "CLI_MAX_ROW_SIZE": 104, + "CLI_MAX_STATEMENT_LEN": 105, + "CLI_MAX_TABLES_IN_SELECT": 106, + "CLI_MAX_USER_NAME_LEN": 107, + "CLI_OJ_CAPABILITIES": 115, + "CLI_XOPEN_CLI_YEAR": 10000, + "CLI_CURSOR_SENSITIVITY": 10001, + "CLI_DESCRIBE_PARAMETER": 10002, + "CLI_CATALOG_NAME": 10003, + "CLI_COLLATION_SEQ": 10004, + "CLI_MAX_IDENTIFIER_LEN": 10005, + } + + +class TFetchOrientation(object): + FETCH_NEXT = 0 + FETCH_PRIOR = 1 + FETCH_RELATIVE = 2 + FETCH_ABSOLUTE = 3 + FETCH_FIRST = 4 + FETCH_LAST = 5 + + _VALUES_TO_NAMES = { + 0: "FETCH_NEXT", + 1: "FETCH_PRIOR", + 2: "FETCH_RELATIVE", + 3: "FETCH_ABSOLUTE", + 4: "FETCH_FIRST", + 5: "FETCH_LAST", + } + + _NAMES_TO_VALUES = { + "FETCH_NEXT": 0, + "FETCH_PRIOR": 1, + "FETCH_RELATIVE": 2, + "FETCH_ABSOLUTE": 3, + "FETCH_FIRST": 4, + "FETCH_LAST": 5, + } + + +class TJobExecutionStatus(object): + IN_PROGRESS = 0 + COMPLETE = 1 + NOT_AVAILABLE = 2 + + _VALUES_TO_NAMES = { + 0: "IN_PROGRESS", + 1: "COMPLETE", + 2: "NOT_AVAILABLE", + } + + _NAMES_TO_VALUES = { + "IN_PROGRESS": 0, + "COMPLETE": 1, + "NOT_AVAILABLE": 2, + } + + +class TTypeQualifierValue(object): + """ + Attributes: + - i32Value + - stringValue + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'i32Value', None, None, ), # 1 + (2, TType.STRING, 'stringValue', 'UTF8', None, ), # 2 + ) + + def __init__(self, i32Value=None, stringValue=None,): + self.i32Value = i32Value + self.stringValue = stringValue + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.i32Value = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.stringValue = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TTypeQualifierValue') + if self.i32Value is not None: + oprot.writeFieldBegin('i32Value', TType.I32, 1) + oprot.writeI32(self.i32Value) + oprot.writeFieldEnd() + if self.stringValue is not None: + oprot.writeFieldBegin('stringValue', TType.STRING, 2) + oprot.writeString(self.stringValue.encode('utf-8') if sys.version_info[0] == 2 else self.stringValue) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TTypeQualifiers(object): + """ + Attributes: + - qualifiers + """ + + thrift_spec = ( + None, # 0 + (1, TType.MAP, 'qualifiers', (TType.STRING, 'UTF8', TType.STRUCT, (TTypeQualifierValue, TTypeQualifierValue.thrift_spec), False), None, ), # 1 + ) + + def __init__(self, qualifiers=None,): + self.qualifiers = qualifiers + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.MAP: + self.qualifiers = {} + (_ktype1, _vtype2, _size0) = iprot.readMapBegin() + for _i4 in range(_size0): + _key5 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val6 = TTypeQualifierValue() + _val6.read(iprot) + self.qualifiers[_key5] = _val6 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TTypeQualifiers') + if self.qualifiers is not None: + oprot.writeFieldBegin('qualifiers', TType.MAP, 1) + oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(self.qualifiers)) + for kiter7, viter8 in self.qualifiers.items(): + oprot.writeString(kiter7.encode('utf-8') if sys.version_info[0] == 2 else kiter7) + viter8.write(oprot) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.qualifiers is None: + raise TProtocolException(message='Required field qualifiers is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TPrimitiveTypeEntry(object): + """ + Attributes: + - type + - typeQualifiers + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'type', None, None, ), # 1 + (2, TType.STRUCT, 'typeQualifiers', (TTypeQualifiers, TTypeQualifiers.thrift_spec), None, ), # 2 + ) + + def __init__(self, type=None, typeQualifiers=None,): + self.type = type + self.typeQualifiers = typeQualifiers + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.type = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.typeQualifiers = TTypeQualifiers() + self.typeQualifiers.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TPrimitiveTypeEntry') + if self.type is not None: + oprot.writeFieldBegin('type', TType.I32, 1) + oprot.writeI32(self.type) + oprot.writeFieldEnd() + if self.typeQualifiers is not None: + oprot.writeFieldBegin('typeQualifiers', TType.STRUCT, 2) + self.typeQualifiers.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.type is None: + raise TProtocolException(message='Required field type is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TArrayTypeEntry(object): + """ + Attributes: + - objectTypePtr + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'objectTypePtr', None, None, ), # 1 + ) + + def __init__(self, objectTypePtr=None,): + self.objectTypePtr = objectTypePtr + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.objectTypePtr = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TArrayTypeEntry') + if self.objectTypePtr is not None: + oprot.writeFieldBegin('objectTypePtr', TType.I32, 1) + oprot.writeI32(self.objectTypePtr) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.objectTypePtr is None: + raise TProtocolException(message='Required field objectTypePtr is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TMapTypeEntry(object): + """ + Attributes: + - keyTypePtr + - valueTypePtr + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'keyTypePtr', None, None, ), # 1 + (2, TType.I32, 'valueTypePtr', None, None, ), # 2 + ) + + def __init__(self, keyTypePtr=None, valueTypePtr=None,): + self.keyTypePtr = keyTypePtr + self.valueTypePtr = valueTypePtr + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.keyTypePtr = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.valueTypePtr = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TMapTypeEntry') + if self.keyTypePtr is not None: + oprot.writeFieldBegin('keyTypePtr', TType.I32, 1) + oprot.writeI32(self.keyTypePtr) + oprot.writeFieldEnd() + if self.valueTypePtr is not None: + oprot.writeFieldBegin('valueTypePtr', TType.I32, 2) + oprot.writeI32(self.valueTypePtr) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.keyTypePtr is None: + raise TProtocolException(message='Required field keyTypePtr is unset!') + if self.valueTypePtr is None: + raise TProtocolException(message='Required field valueTypePtr is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TStructTypeEntry(object): + """ + Attributes: + - nameToTypePtr + """ + + thrift_spec = ( + None, # 0 + (1, TType.MAP, 'nameToTypePtr', (TType.STRING, 'UTF8', TType.I32, None, False), None, ), # 1 + ) + + def __init__(self, nameToTypePtr=None,): + self.nameToTypePtr = nameToTypePtr + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.MAP: + self.nameToTypePtr = {} + (_ktype10, _vtype11, _size9) = iprot.readMapBegin() + for _i13 in range(_size9): + _key14 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val15 = iprot.readI32() + self.nameToTypePtr[_key14] = _val15 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TStructTypeEntry') + if self.nameToTypePtr is not None: + oprot.writeFieldBegin('nameToTypePtr', TType.MAP, 1) + oprot.writeMapBegin(TType.STRING, TType.I32, len(self.nameToTypePtr)) + for kiter16, viter17 in self.nameToTypePtr.items(): + oprot.writeString(kiter16.encode('utf-8') if sys.version_info[0] == 2 else kiter16) + oprot.writeI32(viter17) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.nameToTypePtr is None: + raise TProtocolException(message='Required field nameToTypePtr is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TUnionTypeEntry(object): + """ + Attributes: + - nameToTypePtr + """ + + thrift_spec = ( + None, # 0 + (1, TType.MAP, 'nameToTypePtr', (TType.STRING, 'UTF8', TType.I32, None, False), None, ), # 1 + ) + + def __init__(self, nameToTypePtr=None,): + self.nameToTypePtr = nameToTypePtr + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.MAP: + self.nameToTypePtr = {} + (_ktype19, _vtype20, _size18) = iprot.readMapBegin() + for _i22 in range(_size18): + _key23 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val24 = iprot.readI32() + self.nameToTypePtr[_key23] = _val24 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TUnionTypeEntry') + if self.nameToTypePtr is not None: + oprot.writeFieldBegin('nameToTypePtr', TType.MAP, 1) + oprot.writeMapBegin(TType.STRING, TType.I32, len(self.nameToTypePtr)) + for kiter25, viter26 in self.nameToTypePtr.items(): + oprot.writeString(kiter25.encode('utf-8') if sys.version_info[0] == 2 else kiter25) + oprot.writeI32(viter26) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.nameToTypePtr is None: + raise TProtocolException(message='Required field nameToTypePtr is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TUserDefinedTypeEntry(object): + """ + Attributes: + - typeClassName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'typeClassName', 'UTF8', None, ), # 1 + ) + + def __init__(self, typeClassName=None,): + self.typeClassName = typeClassName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.typeClassName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TUserDefinedTypeEntry') + if self.typeClassName is not None: + oprot.writeFieldBegin('typeClassName', TType.STRING, 1) + oprot.writeString(self.typeClassName.encode('utf-8') if sys.version_info[0] == 2 else self.typeClassName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.typeClassName is None: + raise TProtocolException(message='Required field typeClassName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TTypeEntry(object): + """ + Attributes: + - primitiveEntry + - arrayEntry + - mapEntry + - structEntry + - unionEntry + - userDefinedTypeEntry + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'primitiveEntry', (TPrimitiveTypeEntry, TPrimitiveTypeEntry.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'arrayEntry', (TArrayTypeEntry, TArrayTypeEntry.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'mapEntry', (TMapTypeEntry, TMapTypeEntry.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'structEntry', (TStructTypeEntry, TStructTypeEntry.thrift_spec), None, ), # 4 + (5, TType.STRUCT, 'unionEntry', (TUnionTypeEntry, TUnionTypeEntry.thrift_spec), None, ), # 5 + (6, TType.STRUCT, 'userDefinedTypeEntry', (TUserDefinedTypeEntry, TUserDefinedTypeEntry.thrift_spec), None, ), # 6 + ) + + def __init__(self, primitiveEntry=None, arrayEntry=None, mapEntry=None, structEntry=None, unionEntry=None, userDefinedTypeEntry=None,): + self.primitiveEntry = primitiveEntry + self.arrayEntry = arrayEntry + self.mapEntry = mapEntry + self.structEntry = structEntry + self.unionEntry = unionEntry + self.userDefinedTypeEntry = userDefinedTypeEntry + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.primitiveEntry = TPrimitiveTypeEntry() + self.primitiveEntry.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.arrayEntry = TArrayTypeEntry() + self.arrayEntry.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.mapEntry = TMapTypeEntry() + self.mapEntry.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.structEntry = TStructTypeEntry() + self.structEntry.read(iprot) + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.unionEntry = TUnionTypeEntry() + self.unionEntry.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.userDefinedTypeEntry = TUserDefinedTypeEntry() + self.userDefinedTypeEntry.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TTypeEntry') + if self.primitiveEntry is not None: + oprot.writeFieldBegin('primitiveEntry', TType.STRUCT, 1) + self.primitiveEntry.write(oprot) + oprot.writeFieldEnd() + if self.arrayEntry is not None: + oprot.writeFieldBegin('arrayEntry', TType.STRUCT, 2) + self.arrayEntry.write(oprot) + oprot.writeFieldEnd() + if self.mapEntry is not None: + oprot.writeFieldBegin('mapEntry', TType.STRUCT, 3) + self.mapEntry.write(oprot) + oprot.writeFieldEnd() + if self.structEntry is not None: + oprot.writeFieldBegin('structEntry', TType.STRUCT, 4) + self.structEntry.write(oprot) + oprot.writeFieldEnd() + if self.unionEntry is not None: + oprot.writeFieldBegin('unionEntry', TType.STRUCT, 5) + self.unionEntry.write(oprot) + oprot.writeFieldEnd() + if self.userDefinedTypeEntry is not None: + oprot.writeFieldBegin('userDefinedTypeEntry', TType.STRUCT, 6) + self.userDefinedTypeEntry.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TTypeDesc(object): + """ + Attributes: + - types + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'types', (TType.STRUCT, (TTypeEntry, TTypeEntry.thrift_spec), False), None, ), # 1 + ) + + def __init__(self, types=None,): + self.types = types + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.types = [] + (_etype30, _size27) = iprot.readListBegin() + for _i31 in range(_size27): + _elem32 = TTypeEntry() + _elem32.read(iprot) + self.types.append(_elem32) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TTypeDesc') + if self.types is not None: + oprot.writeFieldBegin('types', TType.LIST, 1) + oprot.writeListBegin(TType.STRUCT, len(self.types)) + for iter33 in self.types: + iter33.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.types is None: + raise TProtocolException(message='Required field types is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumnDesc(object): + """ + Attributes: + - columnName + - typeDesc + - position + - comment + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'columnName', 'UTF8', None, ), # 1 + (2, TType.STRUCT, 'typeDesc', (TTypeDesc, TTypeDesc.thrift_spec), None, ), # 2 + (3, TType.I32, 'position', None, None, ), # 3 + (4, TType.STRING, 'comment', 'UTF8', None, ), # 4 + ) + + def __init__(self, columnName=None, typeDesc=None, position=None, comment=None,): + self.columnName = columnName + self.typeDesc = typeDesc + self.position = position + self.comment = comment + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.columnName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.typeDesc = TTypeDesc() + self.typeDesc.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.position = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.comment = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TColumnDesc') + if self.columnName is not None: + oprot.writeFieldBegin('columnName', TType.STRING, 1) + oprot.writeString(self.columnName.encode('utf-8') if sys.version_info[0] == 2 else self.columnName) + oprot.writeFieldEnd() + if self.typeDesc is not None: + oprot.writeFieldBegin('typeDesc', TType.STRUCT, 2) + self.typeDesc.write(oprot) + oprot.writeFieldEnd() + if self.position is not None: + oprot.writeFieldBegin('position', TType.I32, 3) + oprot.writeI32(self.position) + oprot.writeFieldEnd() + if self.comment is not None: + oprot.writeFieldBegin('comment', TType.STRING, 4) + oprot.writeString(self.comment.encode('utf-8') if sys.version_info[0] == 2 else self.comment) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.columnName is None: + raise TProtocolException(message='Required field columnName is unset!') + if self.typeDesc is None: + raise TProtocolException(message='Required field typeDesc is unset!') + if self.position is None: + raise TProtocolException(message='Required field position is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TTableSchema(object): + """ + Attributes: + - columns + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'columns', (TType.STRUCT, (TColumnDesc, TColumnDesc.thrift_spec), False), None, ), # 1 + ) + + def __init__(self, columns=None,): + self.columns = columns + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.columns = [] + (_etype37, _size34) = iprot.readListBegin() + for _i38 in range(_size34): + _elem39 = TColumnDesc() + _elem39.read(iprot) + self.columns.append(_elem39) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TTableSchema') + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 1) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter40 in self.columns: + iter40.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.columns is None: + raise TProtocolException(message='Required field columns is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TBoolValue(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.BOOL, 'value', None, None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BOOL: + self.value = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TBoolValue') + if self.value is not None: + oprot.writeFieldBegin('value', TType.BOOL, 1) + oprot.writeBool(self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TByteValue(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.BYTE, 'value', None, None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BYTE: + self.value = iprot.readByte() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TByteValue') + if self.value is not None: + oprot.writeFieldBegin('value', TType.BYTE, 1) + oprot.writeByte(self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TI16Value(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.I16, 'value', None, None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I16: + self.value = iprot.readI16() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI16Value') + if self.value is not None: + oprot.writeFieldBegin('value', TType.I16, 1) + oprot.writeI16(self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TI32Value(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'value', None, None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.value = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI32Value') + if self.value is not None: + oprot.writeFieldBegin('value', TType.I32, 1) + oprot.writeI32(self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TI64Value(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.I64, 'value', None, None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I64: + self.value = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI64Value') + if self.value is not None: + oprot.writeFieldBegin('value', TType.I64, 1) + oprot.writeI64(self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TDoubleValue(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.DOUBLE, 'value', None, None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.DOUBLE: + self.value = iprot.readDouble() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TDoubleValue') + if self.value is not None: + oprot.writeFieldBegin('value', TType.DOUBLE, 1) + oprot.writeDouble(self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TStringValue(object): + """ + Attributes: + - value + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'value', 'UTF8', None, ), # 1 + ) + + def __init__(self, value=None,): + self.value = value + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.value = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TStringValue') + if self.value is not None: + oprot.writeFieldBegin('value', TType.STRING, 1) + oprot.writeString(self.value.encode('utf-8') if sys.version_info[0] == 2 else self.value) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumnValue(object): + """ + Attributes: + - boolVal + - byteVal + - i16Val + - i32Val + - i64Val + - doubleVal + - stringVal + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'boolVal', (TBoolValue, TBoolValue.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'byteVal', (TByteValue, TByteValue.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'i16Val', (TI16Value, TI16Value.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'i32Val', (TI32Value, TI32Value.thrift_spec), None, ), # 4 + (5, TType.STRUCT, 'i64Val', (TI64Value, TI64Value.thrift_spec), None, ), # 5 + (6, TType.STRUCT, 'doubleVal', (TDoubleValue, TDoubleValue.thrift_spec), None, ), # 6 + (7, TType.STRUCT, 'stringVal', (TStringValue, TStringValue.thrift_spec), None, ), # 7 + ) + + def __init__(self, boolVal=None, byteVal=None, i16Val=None, i32Val=None, i64Val=None, doubleVal=None, stringVal=None,): + self.boolVal = boolVal + self.byteVal = byteVal + self.i16Val = i16Val + self.i32Val = i32Val + self.i64Val = i64Val + self.doubleVal = doubleVal + self.stringVal = stringVal + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.boolVal = TBoolValue() + self.boolVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.byteVal = TByteValue() + self.byteVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.i16Val = TI16Value() + self.i16Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.i32Val = TI32Value() + self.i32Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.i64Val = TI64Value() + self.i64Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.doubleVal = TDoubleValue() + self.doubleVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRUCT: + self.stringVal = TStringValue() + self.stringVal.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TColumnValue') + if self.boolVal is not None: + oprot.writeFieldBegin('boolVal', TType.STRUCT, 1) + self.boolVal.write(oprot) + oprot.writeFieldEnd() + if self.byteVal is not None: + oprot.writeFieldBegin('byteVal', TType.STRUCT, 2) + self.byteVal.write(oprot) + oprot.writeFieldEnd() + if self.i16Val is not None: + oprot.writeFieldBegin('i16Val', TType.STRUCT, 3) + self.i16Val.write(oprot) + oprot.writeFieldEnd() + if self.i32Val is not None: + oprot.writeFieldBegin('i32Val', TType.STRUCT, 4) + self.i32Val.write(oprot) + oprot.writeFieldEnd() + if self.i64Val is not None: + oprot.writeFieldBegin('i64Val', TType.STRUCT, 5) + self.i64Val.write(oprot) + oprot.writeFieldEnd() + if self.doubleVal is not None: + oprot.writeFieldBegin('doubleVal', TType.STRUCT, 6) + self.doubleVal.write(oprot) + oprot.writeFieldEnd() + if self.stringVal is not None: + oprot.writeFieldBegin('stringVal', TType.STRUCT, 7) + self.stringVal.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TRow(object): + """ + Attributes: + - colVals + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'colVals', (TType.STRUCT, (TColumnValue, TColumnValue.thrift_spec), False), None, ), # 1 + ) + + def __init__(self, colVals=None,): + self.colVals = colVals + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.colVals = [] + (_etype44, _size41) = iprot.readListBegin() + for _i45 in range(_size41): + _elem46 = TColumnValue() + _elem46.read(iprot) + self.colVals.append(_elem46) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TRow') + if self.colVals is not None: + oprot.writeFieldBegin('colVals', TType.LIST, 1) + oprot.writeListBegin(TType.STRUCT, len(self.colVals)) + for iter47 in self.colVals: + iter47.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.colVals is None: + raise TProtocolException(message='Required field colVals is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TBoolColumn(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.BOOL, None, False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype51, _size48) = iprot.readListBegin() + for _i52 in range(_size48): + _elem53 = iprot.readBool() + self.values.append(_elem53) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TBoolColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.BOOL, len(self.values)) + for iter54 in self.values: + oprot.writeBool(iter54) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TByteColumn(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.BYTE, None, False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype58, _size55) = iprot.readListBegin() + for _i59 in range(_size55): + _elem60 = iprot.readByte() + self.values.append(_elem60) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TByteColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.BYTE, len(self.values)) + for iter61 in self.values: + oprot.writeByte(iter61) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TI16Column(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.I16, None, False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype65, _size62) = iprot.readListBegin() + for _i66 in range(_size62): + _elem67 = iprot.readI16() + self.values.append(_elem67) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI16Column') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.I16, len(self.values)) + for iter68 in self.values: + oprot.writeI16(iter68) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TI32Column(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.I32, None, False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype72, _size69) = iprot.readListBegin() + for _i73 in range(_size69): + _elem74 = iprot.readI32() + self.values.append(_elem74) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI32Column') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.I32, len(self.values)) + for iter75 in self.values: + oprot.writeI32(iter75) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TI64Column(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.I64, None, False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype79, _size76) = iprot.readListBegin() + for _i80 in range(_size76): + _elem81 = iprot.readI64() + self.values.append(_elem81) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TI64Column') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.I64, len(self.values)) + for iter82 in self.values: + oprot.writeI64(iter82) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TDoubleColumn(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.DOUBLE, None, False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype86, _size83) = iprot.readListBegin() + for _i87 in range(_size83): + _elem88 = iprot.readDouble() + self.values.append(_elem88) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TDoubleColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.DOUBLE, len(self.values)) + for iter89 in self.values: + oprot.writeDouble(iter89) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TStringColumn(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.STRING, 'UTF8', False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype93, _size90) = iprot.readListBegin() + for _i94 in range(_size90): + _elem95 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.values.append(_elem95) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TStringColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.values)) + for iter96 in self.values: + oprot.writeString(iter96.encode('utf-8') if sys.version_info[0] == 2 else iter96) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TBinaryColumn(object): + """ + Attributes: + - values + - nulls + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'values', (TType.STRING, 'BINARY', False), None, ), # 1 + (2, TType.STRING, 'nulls', 'BINARY', None, ), # 2 + ) + + def __init__(self, values=None, nulls=None,): + self.values = values + self.nulls = nulls + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.values = [] + (_etype100, _size97) = iprot.readListBegin() + for _i101 in range(_size97): + _elem102 = iprot.readBinary() + self.values.append(_elem102) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.nulls = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TBinaryColumn') + if self.values is not None: + oprot.writeFieldBegin('values', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.values)) + for iter103 in self.values: + oprot.writeBinary(iter103) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.nulls is not None: + oprot.writeFieldBegin('nulls', TType.STRING, 2) + oprot.writeBinary(self.nulls) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.values is None: + raise TProtocolException(message='Required field values is unset!') + if self.nulls is None: + raise TProtocolException(message='Required field nulls is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TColumn(object): + """ + Attributes: + - boolVal + - byteVal + - i16Val + - i32Val + - i64Val + - doubleVal + - stringVal + - binaryVal + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'boolVal', (TBoolColumn, TBoolColumn.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'byteVal', (TByteColumn, TByteColumn.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'i16Val', (TI16Column, TI16Column.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'i32Val', (TI32Column, TI32Column.thrift_spec), None, ), # 4 + (5, TType.STRUCT, 'i64Val', (TI64Column, TI64Column.thrift_spec), None, ), # 5 + (6, TType.STRUCT, 'doubleVal', (TDoubleColumn, TDoubleColumn.thrift_spec), None, ), # 6 + (7, TType.STRUCT, 'stringVal', (TStringColumn, TStringColumn.thrift_spec), None, ), # 7 + (8, TType.STRUCT, 'binaryVal', (TBinaryColumn, TBinaryColumn.thrift_spec), None, ), # 8 + ) + + def __init__(self, boolVal=None, byteVal=None, i16Val=None, i32Val=None, i64Val=None, doubleVal=None, stringVal=None, binaryVal=None,): + self.boolVal = boolVal + self.byteVal = byteVal + self.i16Val = i16Val + self.i32Val = i32Val + self.i64Val = i64Val + self.doubleVal = doubleVal + self.stringVal = stringVal + self.binaryVal = binaryVal + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.boolVal = TBoolColumn() + self.boolVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.byteVal = TByteColumn() + self.byteVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.i16Val = TI16Column() + self.i16Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.i32Val = TI32Column() + self.i32Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.i64Val = TI64Column() + self.i64Val.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRUCT: + self.doubleVal = TDoubleColumn() + self.doubleVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRUCT: + self.stringVal = TStringColumn() + self.stringVal.read(iprot) + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.STRUCT: + self.binaryVal = TBinaryColumn() + self.binaryVal.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TColumn') + if self.boolVal is not None: + oprot.writeFieldBegin('boolVal', TType.STRUCT, 1) + self.boolVal.write(oprot) + oprot.writeFieldEnd() + if self.byteVal is not None: + oprot.writeFieldBegin('byteVal', TType.STRUCT, 2) + self.byteVal.write(oprot) + oprot.writeFieldEnd() + if self.i16Val is not None: + oprot.writeFieldBegin('i16Val', TType.STRUCT, 3) + self.i16Val.write(oprot) + oprot.writeFieldEnd() + if self.i32Val is not None: + oprot.writeFieldBegin('i32Val', TType.STRUCT, 4) + self.i32Val.write(oprot) + oprot.writeFieldEnd() + if self.i64Val is not None: + oprot.writeFieldBegin('i64Val', TType.STRUCT, 5) + self.i64Val.write(oprot) + oprot.writeFieldEnd() + if self.doubleVal is not None: + oprot.writeFieldBegin('doubleVal', TType.STRUCT, 6) + self.doubleVal.write(oprot) + oprot.writeFieldEnd() + if self.stringVal is not None: + oprot.writeFieldBegin('stringVal', TType.STRUCT, 7) + self.stringVal.write(oprot) + oprot.writeFieldEnd() + if self.binaryVal is not None: + oprot.writeFieldBegin('binaryVal', TType.STRUCT, 8) + self.binaryVal.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TRowSet(object): + """ + Attributes: + - startRowOffset + - rows + - columns + - binaryColumns + - columnCount + """ + + thrift_spec = ( + None, # 0 + (1, TType.I64, 'startRowOffset', None, None, ), # 1 + (2, TType.LIST, 'rows', (TType.STRUCT, (TRow, TRow.thrift_spec), False), None, ), # 2 + (3, TType.LIST, 'columns', (TType.STRUCT, (TColumn, TColumn.thrift_spec), False), None, ), # 3 + (4, TType.STRING, 'binaryColumns', 'BINARY', None, ), # 4 + (5, TType.I32, 'columnCount', None, None, ), # 5 + ) + + def __init__(self, startRowOffset=None, rows=None, columns=None, binaryColumns=None, columnCount=None,): + self.startRowOffset = startRowOffset + self.rows = rows + self.columns = columns + self.binaryColumns = binaryColumns + self.columnCount = columnCount + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I64: + self.startRowOffset = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.rows = [] + (_etype107, _size104) = iprot.readListBegin() + for _i108 in range(_size104): + _elem109 = TRow() + _elem109.read(iprot) + self.rows.append(_elem109) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.columns = [] + (_etype113, _size110) = iprot.readListBegin() + for _i114 in range(_size110): + _elem115 = TColumn() + _elem115.read(iprot) + self.columns.append(_elem115) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.binaryColumns = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.columnCount = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TRowSet') + if self.startRowOffset is not None: + oprot.writeFieldBegin('startRowOffset', TType.I64, 1) + oprot.writeI64(self.startRowOffset) + oprot.writeFieldEnd() + if self.rows is not None: + oprot.writeFieldBegin('rows', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.rows)) + for iter116 in self.rows: + iter116.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.columns is not None: + oprot.writeFieldBegin('columns', TType.LIST, 3) + oprot.writeListBegin(TType.STRUCT, len(self.columns)) + for iter117 in self.columns: + iter117.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.binaryColumns is not None: + oprot.writeFieldBegin('binaryColumns', TType.STRING, 4) + oprot.writeBinary(self.binaryColumns) + oprot.writeFieldEnd() + if self.columnCount is not None: + oprot.writeFieldBegin('columnCount', TType.I32, 5) + oprot.writeI32(self.columnCount) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.startRowOffset is None: + raise TProtocolException(message='Required field startRowOffset is unset!') + if self.rows is None: + raise TProtocolException(message='Required field rows is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TStatus(object): + """ + Attributes: + - statusCode + - infoMessages + - sqlState + - errorCode + - errorMessage + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'statusCode', None, None, ), # 1 + (2, TType.LIST, 'infoMessages', (TType.STRING, 'UTF8', False), None, ), # 2 + (3, TType.STRING, 'sqlState', 'UTF8', None, ), # 3 + (4, TType.I32, 'errorCode', None, None, ), # 4 + (5, TType.STRING, 'errorMessage', 'UTF8', None, ), # 5 + ) + + def __init__(self, statusCode=None, infoMessages=None, sqlState=None, errorCode=None, errorMessage=None,): + self.statusCode = statusCode + self.infoMessages = infoMessages + self.sqlState = sqlState + self.errorCode = errorCode + self.errorMessage = errorMessage + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.statusCode = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.infoMessages = [] + (_etype121, _size118) = iprot.readListBegin() + for _i122 in range(_size118): + _elem123 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.infoMessages.append(_elem123) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.sqlState = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.errorCode = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.errorMessage = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TStatus') + if self.statusCode is not None: + oprot.writeFieldBegin('statusCode', TType.I32, 1) + oprot.writeI32(self.statusCode) + oprot.writeFieldEnd() + if self.infoMessages is not None: + oprot.writeFieldBegin('infoMessages', TType.LIST, 2) + oprot.writeListBegin(TType.STRING, len(self.infoMessages)) + for iter124 in self.infoMessages: + oprot.writeString(iter124.encode('utf-8') if sys.version_info[0] == 2 else iter124) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.sqlState is not None: + oprot.writeFieldBegin('sqlState', TType.STRING, 3) + oprot.writeString(self.sqlState.encode('utf-8') if sys.version_info[0] == 2 else self.sqlState) + oprot.writeFieldEnd() + if self.errorCode is not None: + oprot.writeFieldBegin('errorCode', TType.I32, 4) + oprot.writeI32(self.errorCode) + oprot.writeFieldEnd() + if self.errorMessage is not None: + oprot.writeFieldBegin('errorMessage', TType.STRING, 5) + oprot.writeString(self.errorMessage.encode('utf-8') if sys.version_info[0] == 2 else self.errorMessage) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.statusCode is None: + raise TProtocolException(message='Required field statusCode is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class THandleIdentifier(object): + """ + Attributes: + - guid + - secret + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'guid', 'BINARY', None, ), # 1 + (2, TType.STRING, 'secret', 'BINARY', None, ), # 2 + ) + + def __init__(self, guid=None, secret=None,): + self.guid = guid + self.secret = secret + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.guid = iprot.readBinary() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.secret = iprot.readBinary() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('THandleIdentifier') + if self.guid is not None: + oprot.writeFieldBegin('guid', TType.STRING, 1) + oprot.writeBinary(self.guid) + oprot.writeFieldEnd() + if self.secret is not None: + oprot.writeFieldBegin('secret', TType.STRING, 2) + oprot.writeBinary(self.secret) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.guid is None: + raise TProtocolException(message='Required field guid is unset!') + if self.secret is None: + raise TProtocolException(message='Required field secret is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TSessionHandle(object): + """ + Attributes: + - sessionId + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionId', (THandleIdentifier, THandleIdentifier.thrift_spec), None, ), # 1 + ) + + def __init__(self, sessionId=None,): + self.sessionId = sessionId + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionId = THandleIdentifier() + self.sessionId.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TSessionHandle') + if self.sessionId is not None: + oprot.writeFieldBegin('sessionId', TType.STRUCT, 1) + self.sessionId.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionId is None: + raise TProtocolException(message='Required field sessionId is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TOperationHandle(object): + """ + Attributes: + - operationId + - operationType + - hasResultSet + - modifiedRowCount + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationId', (THandleIdentifier, THandleIdentifier.thrift_spec), None, ), # 1 + (2, TType.I32, 'operationType', None, None, ), # 2 + (3, TType.BOOL, 'hasResultSet', None, None, ), # 3 + (4, TType.DOUBLE, 'modifiedRowCount', None, None, ), # 4 + ) + + def __init__(self, operationId=None, operationType=None, hasResultSet=None, modifiedRowCount=None,): + self.operationId = operationId + self.operationType = operationType + self.hasResultSet = hasResultSet + self.modifiedRowCount = modifiedRowCount + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationId = THandleIdentifier() + self.operationId.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.operationType = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.hasResultSet = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.DOUBLE: + self.modifiedRowCount = iprot.readDouble() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TOperationHandle') + if self.operationId is not None: + oprot.writeFieldBegin('operationId', TType.STRUCT, 1) + self.operationId.write(oprot) + oprot.writeFieldEnd() + if self.operationType is not None: + oprot.writeFieldBegin('operationType', TType.I32, 2) + oprot.writeI32(self.operationType) + oprot.writeFieldEnd() + if self.hasResultSet is not None: + oprot.writeFieldBegin('hasResultSet', TType.BOOL, 3) + oprot.writeBool(self.hasResultSet) + oprot.writeFieldEnd() + if self.modifiedRowCount is not None: + oprot.writeFieldBegin('modifiedRowCount', TType.DOUBLE, 4) + oprot.writeDouble(self.modifiedRowCount) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationId is None: + raise TProtocolException(message='Required field operationId is unset!') + if self.operationType is None: + raise TProtocolException(message='Required field operationType is unset!') + if self.hasResultSet is None: + raise TProtocolException(message='Required field hasResultSet is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TOpenSessionReq(object): + """ + Attributes: + - client_protocol + - username + - password + - configuration + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'client_protocol', None, 9, ), # 1 + (2, TType.STRING, 'username', 'UTF8', None, ), # 2 + (3, TType.STRING, 'password', 'UTF8', None, ), # 3 + (4, TType.MAP, 'configuration', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 4 + ) + + def __init__(self, client_protocol=thrift_spec[1][4], username=None, password=None, configuration=None,): + self.client_protocol = client_protocol + self.username = username + self.password = password + self.configuration = configuration + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.client_protocol = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.password = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.MAP: + self.configuration = {} + (_ktype126, _vtype127, _size125) = iprot.readMapBegin() + for _i129 in range(_size125): + _key130 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val131 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.configuration[_key130] = _val131 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TOpenSessionReq') + if self.client_protocol is not None: + oprot.writeFieldBegin('client_protocol', TType.I32, 1) + oprot.writeI32(self.client_protocol) + oprot.writeFieldEnd() + if self.username is not None: + oprot.writeFieldBegin('username', TType.STRING, 2) + oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username) + oprot.writeFieldEnd() + if self.password is not None: + oprot.writeFieldBegin('password', TType.STRING, 3) + oprot.writeString(self.password.encode('utf-8') if sys.version_info[0] == 2 else self.password) + oprot.writeFieldEnd() + if self.configuration is not None: + oprot.writeFieldBegin('configuration', TType.MAP, 4) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) + for kiter132, viter133 in self.configuration.items(): + oprot.writeString(kiter132.encode('utf-8') if sys.version_info[0] == 2 else kiter132) + oprot.writeString(viter133.encode('utf-8') if sys.version_info[0] == 2 else viter133) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.client_protocol is None: + raise TProtocolException(message='Required field client_protocol is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TOpenSessionResp(object): + """ + Attributes: + - status + - serverProtocolVersion + - sessionHandle + - configuration + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.I32, 'serverProtocolVersion', None, 9, ), # 2 + (3, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 3 + (4, TType.MAP, 'configuration', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 4 + ) + + def __init__(self, status=None, serverProtocolVersion=thrift_spec[2][4], sessionHandle=None, configuration=None,): + self.status = status + self.serverProtocolVersion = serverProtocolVersion + self.sessionHandle = sessionHandle + self.configuration = configuration + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.serverProtocolVersion = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.MAP: + self.configuration = {} + (_ktype135, _vtype136, _size134) = iprot.readMapBegin() + for _i138 in range(_size134): + _key139 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val140 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.configuration[_key139] = _val140 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TOpenSessionResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.serverProtocolVersion is not None: + oprot.writeFieldBegin('serverProtocolVersion', TType.I32, 2) + oprot.writeI32(self.serverProtocolVersion) + oprot.writeFieldEnd() + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 3) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.configuration is not None: + oprot.writeFieldBegin('configuration', TType.MAP, 4) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.configuration)) + for kiter141, viter142 in self.configuration.items(): + oprot.writeString(kiter141.encode('utf-8') if sys.version_info[0] == 2 else kiter141) + oprot.writeString(viter142.encode('utf-8') if sys.version_info[0] == 2 else viter142) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + if self.serverProtocolVersion is None: + raise TProtocolException(message='Required field serverProtocolVersion is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCloseSessionReq(object): + """ + Attributes: + - sessionHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, sessionHandle=None,): + self.sessionHandle = sessionHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCloseSessionReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCloseSessionResp(object): + """ + Attributes: + - status + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + ) + + def __init__(self, status=None,): + self.status = status + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCloseSessionResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetInfoValue(object): + """ + Attributes: + - stringValue + - smallIntValue + - integerBitmask + - integerFlag + - binaryValue + - lenValue + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'stringValue', 'UTF8', None, ), # 1 + (2, TType.I16, 'smallIntValue', None, None, ), # 2 + (3, TType.I32, 'integerBitmask', None, None, ), # 3 + (4, TType.I32, 'integerFlag', None, None, ), # 4 + (5, TType.I32, 'binaryValue', None, None, ), # 5 + (6, TType.I64, 'lenValue', None, None, ), # 6 + ) + + def __init__(self, stringValue=None, smallIntValue=None, integerBitmask=None, integerFlag=None, binaryValue=None, lenValue=None,): + self.stringValue = stringValue + self.smallIntValue = smallIntValue + self.integerBitmask = integerBitmask + self.integerFlag = integerFlag + self.binaryValue = binaryValue + self.lenValue = lenValue + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.stringValue = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I16: + self.smallIntValue = iprot.readI16() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.integerBitmask = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.integerFlag = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I32: + self.binaryValue = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I64: + self.lenValue = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetInfoValue') + if self.stringValue is not None: + oprot.writeFieldBegin('stringValue', TType.STRING, 1) + oprot.writeString(self.stringValue.encode('utf-8') if sys.version_info[0] == 2 else self.stringValue) + oprot.writeFieldEnd() + if self.smallIntValue is not None: + oprot.writeFieldBegin('smallIntValue', TType.I16, 2) + oprot.writeI16(self.smallIntValue) + oprot.writeFieldEnd() + if self.integerBitmask is not None: + oprot.writeFieldBegin('integerBitmask', TType.I32, 3) + oprot.writeI32(self.integerBitmask) + oprot.writeFieldEnd() + if self.integerFlag is not None: + oprot.writeFieldBegin('integerFlag', TType.I32, 4) + oprot.writeI32(self.integerFlag) + oprot.writeFieldEnd() + if self.binaryValue is not None: + oprot.writeFieldBegin('binaryValue', TType.I32, 5) + oprot.writeI32(self.binaryValue) + oprot.writeFieldEnd() + if self.lenValue is not None: + oprot.writeFieldBegin('lenValue', TType.I64, 6) + oprot.writeI64(self.lenValue) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetInfoReq(object): + """ + Attributes: + - sessionHandle + - infoType + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.I32, 'infoType', None, None, ), # 2 + ) + + def __init__(self, sessionHandle=None, infoType=None,): + self.sessionHandle = sessionHandle + self.infoType = infoType + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.infoType = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetInfoReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.infoType is not None: + oprot.writeFieldBegin('infoType', TType.I32, 2) + oprot.writeI32(self.infoType) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + if self.infoType is None: + raise TProtocolException(message='Required field infoType is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetInfoResp(object): + """ + Attributes: + - status + - infoValue + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'infoValue', (TGetInfoValue, TGetInfoValue.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, infoValue=None,): + self.status = status + self.infoValue = infoValue + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.infoValue = TGetInfoValue() + self.infoValue.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetInfoResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.infoValue is not None: + oprot.writeFieldBegin('infoValue', TType.STRUCT, 2) + self.infoValue.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + if self.infoValue is None: + raise TProtocolException(message='Required field infoValue is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TExecuteStatementReq(object): + """ + Attributes: + - sessionHandle + - statement + - confOverlay + - runAsync + - queryTimeout + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'statement', 'UTF8', None, ), # 2 + (3, TType.MAP, 'confOverlay', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 3 + (4, TType.BOOL, 'runAsync', None, False, ), # 4 + (5, TType.I64, 'queryTimeout', None, 0, ), # 5 + ) + + def __init__(self, sessionHandle=None, statement=None, confOverlay=None, runAsync=thrift_spec[4][4], queryTimeout=thrift_spec[5][4],): + self.sessionHandle = sessionHandle + self.statement = statement + self.confOverlay = confOverlay + self.runAsync = runAsync + self.queryTimeout = queryTimeout + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.statement = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.MAP: + self.confOverlay = {} + (_ktype144, _vtype145, _size143) = iprot.readMapBegin() + for _i147 in range(_size143): + _key148 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val149 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.confOverlay[_key148] = _val149 + iprot.readMapEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.BOOL: + self.runAsync = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.I64: + self.queryTimeout = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TExecuteStatementReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.statement is not None: + oprot.writeFieldBegin('statement', TType.STRING, 2) + oprot.writeString(self.statement.encode('utf-8') if sys.version_info[0] == 2 else self.statement) + oprot.writeFieldEnd() + if self.confOverlay is not None: + oprot.writeFieldBegin('confOverlay', TType.MAP, 3) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.confOverlay)) + for kiter150, viter151 in self.confOverlay.items(): + oprot.writeString(kiter150.encode('utf-8') if sys.version_info[0] == 2 else kiter150) + oprot.writeString(viter151.encode('utf-8') if sys.version_info[0] == 2 else viter151) + oprot.writeMapEnd() + oprot.writeFieldEnd() + if self.runAsync is not None: + oprot.writeFieldBegin('runAsync', TType.BOOL, 4) + oprot.writeBool(self.runAsync) + oprot.writeFieldEnd() + if self.queryTimeout is not None: + oprot.writeFieldBegin('queryTimeout', TType.I64, 5) + oprot.writeI64(self.queryTimeout) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + if self.statement is None: + raise TProtocolException(message='Required field statement is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TExecuteStatementResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TExecuteStatementResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetTypeInfoReq(object): + """ + Attributes: + - sessionHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, sessionHandle=None,): + self.sessionHandle = sessionHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetTypeInfoReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetTypeInfoResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetTypeInfoResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetCatalogsReq(object): + """ + Attributes: + - sessionHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, sessionHandle=None,): + self.sessionHandle = sessionHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetCatalogsReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetCatalogsResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetCatalogsResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetSchemasReq(object): + """ + Attributes: + - sessionHandle + - catalogName + - schemaName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'catalogName', 'UTF8', None, ), # 2 + (3, TType.STRING, 'schemaName', 'UTF8', None, ), # 3 + ) + + def __init__(self, sessionHandle=None, catalogName=None, schemaName=None,): + self.sessionHandle = sessionHandle + self.catalogName = catalogName + self.schemaName = schemaName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.catalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.schemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetSchemasReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.catalogName is not None: + oprot.writeFieldBegin('catalogName', TType.STRING, 2) + oprot.writeString(self.catalogName.encode('utf-8') if sys.version_info[0] == 2 else self.catalogName) + oprot.writeFieldEnd() + if self.schemaName is not None: + oprot.writeFieldBegin('schemaName', TType.STRING, 3) + oprot.writeString(self.schemaName.encode('utf-8') if sys.version_info[0] == 2 else self.schemaName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetSchemasResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetSchemasResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetTablesReq(object): + """ + Attributes: + - sessionHandle + - catalogName + - schemaName + - tableName + - tableTypes + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'catalogName', 'UTF8', None, ), # 2 + (3, TType.STRING, 'schemaName', 'UTF8', None, ), # 3 + (4, TType.STRING, 'tableName', 'UTF8', None, ), # 4 + (5, TType.LIST, 'tableTypes', (TType.STRING, 'UTF8', False), None, ), # 5 + ) + + def __init__(self, sessionHandle=None, catalogName=None, schemaName=None, tableName=None, tableTypes=None,): + self.sessionHandle = sessionHandle + self.catalogName = catalogName + self.schemaName = schemaName + self.tableName = tableName + self.tableTypes = tableTypes + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.catalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.schemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.tableName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.LIST: + self.tableTypes = [] + (_etype155, _size152) = iprot.readListBegin() + for _i156 in range(_size152): + _elem157 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.tableTypes.append(_elem157) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetTablesReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.catalogName is not None: + oprot.writeFieldBegin('catalogName', TType.STRING, 2) + oprot.writeString(self.catalogName.encode('utf-8') if sys.version_info[0] == 2 else self.catalogName) + oprot.writeFieldEnd() + if self.schemaName is not None: + oprot.writeFieldBegin('schemaName', TType.STRING, 3) + oprot.writeString(self.schemaName.encode('utf-8') if sys.version_info[0] == 2 else self.schemaName) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRING, 4) + oprot.writeString(self.tableName.encode('utf-8') if sys.version_info[0] == 2 else self.tableName) + oprot.writeFieldEnd() + if self.tableTypes is not None: + oprot.writeFieldBegin('tableTypes', TType.LIST, 5) + oprot.writeListBegin(TType.STRING, len(self.tableTypes)) + for iter158 in self.tableTypes: + oprot.writeString(iter158.encode('utf-8') if sys.version_info[0] == 2 else iter158) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetTablesResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetTablesResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetTableTypesReq(object): + """ + Attributes: + - sessionHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, sessionHandle=None,): + self.sessionHandle = sessionHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetTableTypesReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetTableTypesResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetTableTypesResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetColumnsReq(object): + """ + Attributes: + - sessionHandle + - catalogName + - schemaName + - tableName + - columnName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'catalogName', 'UTF8', None, ), # 2 + (3, TType.STRING, 'schemaName', 'UTF8', None, ), # 3 + (4, TType.STRING, 'tableName', 'UTF8', None, ), # 4 + (5, TType.STRING, 'columnName', 'UTF8', None, ), # 5 + ) + + def __init__(self, sessionHandle=None, catalogName=None, schemaName=None, tableName=None, columnName=None,): + self.sessionHandle = sessionHandle + self.catalogName = catalogName + self.schemaName = schemaName + self.tableName = tableName + self.columnName = columnName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.catalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.schemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.tableName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.columnName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetColumnsReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.catalogName is not None: + oprot.writeFieldBegin('catalogName', TType.STRING, 2) + oprot.writeString(self.catalogName.encode('utf-8') if sys.version_info[0] == 2 else self.catalogName) + oprot.writeFieldEnd() + if self.schemaName is not None: + oprot.writeFieldBegin('schemaName', TType.STRING, 3) + oprot.writeString(self.schemaName.encode('utf-8') if sys.version_info[0] == 2 else self.schemaName) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRING, 4) + oprot.writeString(self.tableName.encode('utf-8') if sys.version_info[0] == 2 else self.tableName) + oprot.writeFieldEnd() + if self.columnName is not None: + oprot.writeFieldBegin('columnName', TType.STRING, 5) + oprot.writeString(self.columnName.encode('utf-8') if sys.version_info[0] == 2 else self.columnName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetColumnsResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetColumnsResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetFunctionsReq(object): + """ + Attributes: + - sessionHandle + - catalogName + - schemaName + - functionName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'catalogName', 'UTF8', None, ), # 2 + (3, TType.STRING, 'schemaName', 'UTF8', None, ), # 3 + (4, TType.STRING, 'functionName', 'UTF8', None, ), # 4 + ) + + def __init__(self, sessionHandle=None, catalogName=None, schemaName=None, functionName=None,): + self.sessionHandle = sessionHandle + self.catalogName = catalogName + self.schemaName = schemaName + self.functionName = functionName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.catalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.schemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.functionName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetFunctionsReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.catalogName is not None: + oprot.writeFieldBegin('catalogName', TType.STRING, 2) + oprot.writeString(self.catalogName.encode('utf-8') if sys.version_info[0] == 2 else self.catalogName) + oprot.writeFieldEnd() + if self.schemaName is not None: + oprot.writeFieldBegin('schemaName', TType.STRING, 3) + oprot.writeString(self.schemaName.encode('utf-8') if sys.version_info[0] == 2 else self.schemaName) + oprot.writeFieldEnd() + if self.functionName is not None: + oprot.writeFieldBegin('functionName', TType.STRING, 4) + oprot.writeString(self.functionName.encode('utf-8') if sys.version_info[0] == 2 else self.functionName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + if self.functionName is None: + raise TProtocolException(message='Required field functionName is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetFunctionsResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetFunctionsResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetPrimaryKeysReq(object): + """ + Attributes: + - sessionHandle + - catalogName + - schemaName + - tableName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'catalogName', 'UTF8', None, ), # 2 + (3, TType.STRING, 'schemaName', 'UTF8', None, ), # 3 + (4, TType.STRING, 'tableName', 'UTF8', None, ), # 4 + ) + + def __init__(self, sessionHandle=None, catalogName=None, schemaName=None, tableName=None,): + self.sessionHandle = sessionHandle + self.catalogName = catalogName + self.schemaName = schemaName + self.tableName = tableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.catalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.schemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.tableName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetPrimaryKeysReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.catalogName is not None: + oprot.writeFieldBegin('catalogName', TType.STRING, 2) + oprot.writeString(self.catalogName.encode('utf-8') if sys.version_info[0] == 2 else self.catalogName) + oprot.writeFieldEnd() + if self.schemaName is not None: + oprot.writeFieldBegin('schemaName', TType.STRING, 3) + oprot.writeString(self.schemaName.encode('utf-8') if sys.version_info[0] == 2 else self.schemaName) + oprot.writeFieldEnd() + if self.tableName is not None: + oprot.writeFieldBegin('tableName', TType.STRING, 4) + oprot.writeString(self.tableName.encode('utf-8') if sys.version_info[0] == 2 else self.tableName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetPrimaryKeysResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetPrimaryKeysResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetCrossReferenceReq(object): + """ + Attributes: + - sessionHandle + - parentCatalogName + - parentSchemaName + - parentTableName + - foreignCatalogName + - foreignSchemaName + - foreignTableName + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'parentCatalogName', 'UTF8', None, ), # 2 + (3, TType.STRING, 'parentSchemaName', 'UTF8', None, ), # 3 + (4, TType.STRING, 'parentTableName', 'UTF8', None, ), # 4 + (5, TType.STRING, 'foreignCatalogName', 'UTF8', None, ), # 5 + (6, TType.STRING, 'foreignSchemaName', 'UTF8', None, ), # 6 + (7, TType.STRING, 'foreignTableName', 'UTF8', None, ), # 7 + ) + + def __init__(self, sessionHandle=None, parentCatalogName=None, parentSchemaName=None, parentTableName=None, foreignCatalogName=None, foreignSchemaName=None, foreignTableName=None,): + self.sessionHandle = sessionHandle + self.parentCatalogName = parentCatalogName + self.parentSchemaName = parentSchemaName + self.parentTableName = parentTableName + self.foreignCatalogName = foreignCatalogName + self.foreignSchemaName = foreignSchemaName + self.foreignTableName = foreignTableName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.parentCatalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.parentSchemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.parentTableName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.foreignCatalogName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.foreignSchemaName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.STRING: + self.foreignTableName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetCrossReferenceReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.parentCatalogName is not None: + oprot.writeFieldBegin('parentCatalogName', TType.STRING, 2) + oprot.writeString(self.parentCatalogName.encode('utf-8') if sys.version_info[0] == 2 else self.parentCatalogName) + oprot.writeFieldEnd() + if self.parentSchemaName is not None: + oprot.writeFieldBegin('parentSchemaName', TType.STRING, 3) + oprot.writeString(self.parentSchemaName.encode('utf-8') if sys.version_info[0] == 2 else self.parentSchemaName) + oprot.writeFieldEnd() + if self.parentTableName is not None: + oprot.writeFieldBegin('parentTableName', TType.STRING, 4) + oprot.writeString(self.parentTableName.encode('utf-8') if sys.version_info[0] == 2 else self.parentTableName) + oprot.writeFieldEnd() + if self.foreignCatalogName is not None: + oprot.writeFieldBegin('foreignCatalogName', TType.STRING, 5) + oprot.writeString(self.foreignCatalogName.encode('utf-8') if sys.version_info[0] == 2 else self.foreignCatalogName) + oprot.writeFieldEnd() + if self.foreignSchemaName is not None: + oprot.writeFieldBegin('foreignSchemaName', TType.STRING, 6) + oprot.writeString(self.foreignSchemaName.encode('utf-8') if sys.version_info[0] == 2 else self.foreignSchemaName) + oprot.writeFieldEnd() + if self.foreignTableName is not None: + oprot.writeFieldBegin('foreignTableName', TType.STRING, 7) + oprot.writeString(self.foreignTableName.encode('utf-8') if sys.version_info[0] == 2 else self.foreignTableName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetCrossReferenceResp(object): + """ + Attributes: + - status + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, operationHandle=None,): + self.status = status + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetCrossReferenceResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 2) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TProgressUpdateResp(object): + """ + Attributes: + - headerNames + - rows + - progressedPercentage + - status + - footerSummary + - startTime + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'headerNames', (TType.STRING, 'UTF8', False), None, ), # 1 + (2, TType.LIST, 'rows', (TType.LIST, (TType.STRING, 'UTF8', False), False), None, ), # 2 + (3, TType.DOUBLE, 'progressedPercentage', None, None, ), # 3 + (4, TType.I32, 'status', None, None, ), # 4 + (5, TType.STRING, 'footerSummary', 'UTF8', None, ), # 5 + (6, TType.I64, 'startTime', None, None, ), # 6 + ) + + def __init__(self, headerNames=None, rows=None, progressedPercentage=None, status=None, footerSummary=None, startTime=None,): + self.headerNames = headerNames + self.rows = rows + self.progressedPercentage = progressedPercentage + self.status = status + self.footerSummary = footerSummary + self.startTime = startTime + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.LIST: + self.headerNames = [] + (_etype162, _size159) = iprot.readListBegin() + for _i163 in range(_size159): + _elem164 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.headerNames.append(_elem164) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.rows = [] + (_etype168, _size165) = iprot.readListBegin() + for _i169 in range(_size165): + _elem170 = [] + (_etype174, _size171) = iprot.readListBegin() + for _i175 in range(_size171): + _elem176 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _elem170.append(_elem176) + iprot.readListEnd() + self.rows.append(_elem170) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.DOUBLE: + self.progressedPercentage = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.status = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.footerSummary = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I64: + self.startTime = iprot.readI64() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TProgressUpdateResp') + if self.headerNames is not None: + oprot.writeFieldBegin('headerNames', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.headerNames)) + for iter177 in self.headerNames: + oprot.writeString(iter177.encode('utf-8') if sys.version_info[0] == 2 else iter177) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.rows is not None: + oprot.writeFieldBegin('rows', TType.LIST, 2) + oprot.writeListBegin(TType.LIST, len(self.rows)) + for iter178 in self.rows: + oprot.writeListBegin(TType.STRING, len(iter178)) + for iter179 in iter178: + oprot.writeString(iter179.encode('utf-8') if sys.version_info[0] == 2 else iter179) + oprot.writeListEnd() + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.progressedPercentage is not None: + oprot.writeFieldBegin('progressedPercentage', TType.DOUBLE, 3) + oprot.writeDouble(self.progressedPercentage) + oprot.writeFieldEnd() + if self.status is not None: + oprot.writeFieldBegin('status', TType.I32, 4) + oprot.writeI32(self.status) + oprot.writeFieldEnd() + if self.footerSummary is not None: + oprot.writeFieldBegin('footerSummary', TType.STRING, 5) + oprot.writeString(self.footerSummary.encode('utf-8') if sys.version_info[0] == 2 else self.footerSummary) + oprot.writeFieldEnd() + if self.startTime is not None: + oprot.writeFieldBegin('startTime', TType.I64, 6) + oprot.writeI64(self.startTime) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.headerNames is None: + raise TProtocolException(message='Required field headerNames is unset!') + if self.rows is None: + raise TProtocolException(message='Required field rows is unset!') + if self.progressedPercentage is None: + raise TProtocolException(message='Required field progressedPercentage is unset!') + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + if self.footerSummary is None: + raise TProtocolException(message='Required field footerSummary is unset!') + if self.startTime is None: + raise TProtocolException(message='Required field startTime is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TGetOperationStatusReq(object): + """ + Attributes: + - operationHandle + - getProgressUpdate + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + (2, TType.BOOL, 'getProgressUpdate', None, None, ), # 2 + ) + + def __init__(self, operationHandle=None, getProgressUpdate=None,): + self.operationHandle = operationHandle + self.getProgressUpdate = getProgressUpdate + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.getProgressUpdate = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetOperationStatusReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + if self.getProgressUpdate is not None: + oprot.writeFieldBegin('getProgressUpdate', TType.BOOL, 2) + oprot.writeBool(self.getProgressUpdate) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocolException(message='Required field operationHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetOperationStatusResp(object): + """ + Attributes: + - status + - operationState + - sqlState + - errorCode + - errorMessage + - taskStatus + - operationStarted + - operationCompleted + - hasResultSet + - progressUpdateResponse + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.I32, 'operationState', None, None, ), # 2 + (3, TType.STRING, 'sqlState', 'UTF8', None, ), # 3 + (4, TType.I32, 'errorCode', None, None, ), # 4 + (5, TType.STRING, 'errorMessage', 'UTF8', None, ), # 5 + (6, TType.STRING, 'taskStatus', 'UTF8', None, ), # 6 + (7, TType.I64, 'operationStarted', None, None, ), # 7 + (8, TType.I64, 'operationCompleted', None, None, ), # 8 + (9, TType.BOOL, 'hasResultSet', None, None, ), # 9 + (10, TType.STRUCT, 'progressUpdateResponse', (TProgressUpdateResp, TProgressUpdateResp.thrift_spec), None, ), # 10 + ) + + def __init__(self, status=None, operationState=None, sqlState=None, errorCode=None, errorMessage=None, taskStatus=None, operationStarted=None, operationCompleted=None, hasResultSet=None, progressUpdateResponse=None,): + self.status = status + self.operationState = operationState + self.sqlState = sqlState + self.errorCode = errorCode + self.errorMessage = errorMessage + self.taskStatus = taskStatus + self.operationStarted = operationStarted + self.operationCompleted = operationCompleted + self.hasResultSet = hasResultSet + self.progressUpdateResponse = progressUpdateResponse + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.operationState = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.sqlState = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.errorCode = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.errorMessage = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.taskStatus = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I64: + self.operationStarted = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.I64: + self.operationCompleted = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.BOOL: + self.hasResultSet = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 10: + if ftype == TType.STRUCT: + self.progressUpdateResponse = TProgressUpdateResp() + self.progressUpdateResponse.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetOperationStatusResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.operationState is not None: + oprot.writeFieldBegin('operationState', TType.I32, 2) + oprot.writeI32(self.operationState) + oprot.writeFieldEnd() + if self.sqlState is not None: + oprot.writeFieldBegin('sqlState', TType.STRING, 3) + oprot.writeString(self.sqlState.encode('utf-8') if sys.version_info[0] == 2 else self.sqlState) + oprot.writeFieldEnd() + if self.errorCode is not None: + oprot.writeFieldBegin('errorCode', TType.I32, 4) + oprot.writeI32(self.errorCode) + oprot.writeFieldEnd() + if self.errorMessage is not None: + oprot.writeFieldBegin('errorMessage', TType.STRING, 5) + oprot.writeString(self.errorMessage.encode('utf-8') if sys.version_info[0] == 2 else self.errorMessage) + oprot.writeFieldEnd() + if self.taskStatus is not None: + oprot.writeFieldBegin('taskStatus', TType.STRING, 6) + oprot.writeString(self.taskStatus.encode('utf-8') if sys.version_info[0] == 2 else self.taskStatus) + oprot.writeFieldEnd() + if self.operationStarted is not None: + oprot.writeFieldBegin('operationStarted', TType.I64, 7) + oprot.writeI64(self.operationStarted) + oprot.writeFieldEnd() + if self.operationCompleted is not None: + oprot.writeFieldBegin('operationCompleted', TType.I64, 8) + oprot.writeI64(self.operationCompleted) + oprot.writeFieldEnd() + if self.hasResultSet is not None: + oprot.writeFieldBegin('hasResultSet', TType.BOOL, 9) + oprot.writeBool(self.hasResultSet) + oprot.writeFieldEnd() + if self.progressUpdateResponse is not None: + oprot.writeFieldBegin('progressUpdateResponse', TType.STRUCT, 10) + self.progressUpdateResponse.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCancelOperationReq(object): + """ + Attributes: + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, operationHandle=None,): + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCancelOperationReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocolException(message='Required field operationHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCancelOperationResp(object): + """ + Attributes: + - status + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + ) + + def __init__(self, status=None,): + self.status = status + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCancelOperationResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCloseOperationReq(object): + """ + Attributes: + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, operationHandle=None,): + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCloseOperationReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocolException(message='Required field operationHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCloseOperationResp(object): + """ + Attributes: + - status + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + ) + + def __init__(self, status=None,): + self.status = status + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCloseOperationResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetResultSetMetadataReq(object): + """ + Attributes: + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, operationHandle=None,): + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetResultSetMetadataReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocolException(message='Required field operationHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetResultSetMetadataResp(object): + """ + Attributes: + - status + - schema + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'schema', (TTableSchema, TTableSchema.thrift_spec), None, ), # 2 + ) + + def __init__(self, status=None, schema=None,): + self.status = status + self.schema = schema + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.schema = TTableSchema() + self.schema.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetResultSetMetadataResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.schema is not None: + oprot.writeFieldBegin('schema', TType.STRUCT, 2) + self.schema.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TFetchResultsReq(object): + """ + Attributes: + - operationHandle + - orientation + - maxRows + - fetchType + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + (2, TType.I32, 'orientation', None, 0, ), # 2 + (3, TType.I64, 'maxRows', None, None, ), # 3 + (4, TType.I16, 'fetchType', None, 0, ), # 4 + ) + + def __init__(self, operationHandle=None, orientation=thrift_spec[2][4], maxRows=None, fetchType=thrift_spec[4][4],): + self.operationHandle = operationHandle + self.orientation = orientation + self.maxRows = maxRows + self.fetchType = fetchType + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.orientation = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.maxRows = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I16: + self.fetchType = iprot.readI16() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TFetchResultsReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + if self.orientation is not None: + oprot.writeFieldBegin('orientation', TType.I32, 2) + oprot.writeI32(self.orientation) + oprot.writeFieldEnd() + if self.maxRows is not None: + oprot.writeFieldBegin('maxRows', TType.I64, 3) + oprot.writeI64(self.maxRows) + oprot.writeFieldEnd() + if self.fetchType is not None: + oprot.writeFieldBegin('fetchType', TType.I16, 4) + oprot.writeI16(self.fetchType) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocolException(message='Required field operationHandle is unset!') + if self.orientation is None: + raise TProtocolException(message='Required field orientation is unset!') + if self.maxRows is None: + raise TProtocolException(message='Required field maxRows is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TFetchResultsResp(object): + """ + Attributes: + - status + - hasMoreRows + - results + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.BOOL, 'hasMoreRows', None, None, ), # 2 + (3, TType.STRUCT, 'results', (TRowSet, TRowSet.thrift_spec), None, ), # 3 + ) + + def __init__(self, status=None, hasMoreRows=None, results=None,): + self.status = status + self.hasMoreRows = hasMoreRows + self.results = results + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.hasMoreRows = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.results = TRowSet() + self.results.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TFetchResultsResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.hasMoreRows is not None: + oprot.writeFieldBegin('hasMoreRows', TType.BOOL, 2) + oprot.writeBool(self.hasMoreRows) + oprot.writeFieldEnd() + if self.results is not None: + oprot.writeFieldBegin('results', TType.STRUCT, 3) + self.results.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetDelegationTokenReq(object): + """ + Attributes: + - sessionHandle + - owner + - renewer + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'owner', 'UTF8', None, ), # 2 + (3, TType.STRING, 'renewer', 'UTF8', None, ), # 3 + ) + + def __init__(self, sessionHandle=None, owner=None, renewer=None,): + self.sessionHandle = sessionHandle + self.owner = owner + self.renewer = renewer + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.owner = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.renewer = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetDelegationTokenReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.owner is not None: + oprot.writeFieldBegin('owner', TType.STRING, 2) + oprot.writeString(self.owner.encode('utf-8') if sys.version_info[0] == 2 else self.owner) + oprot.writeFieldEnd() + if self.renewer is not None: + oprot.writeFieldBegin('renewer', TType.STRING, 3) + oprot.writeString(self.renewer.encode('utf-8') if sys.version_info[0] == 2 else self.renewer) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + if self.owner is None: + raise TProtocolException(message='Required field owner is unset!') + if self.renewer is None: + raise TProtocolException(message='Required field renewer is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetDelegationTokenResp(object): + """ + Attributes: + - status + - delegationToken + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRING, 'delegationToken', 'UTF8', None, ), # 2 + ) + + def __init__(self, status=None, delegationToken=None,): + self.status = status + self.delegationToken = delegationToken + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.delegationToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetDelegationTokenResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.delegationToken is not None: + oprot.writeFieldBegin('delegationToken', TType.STRING, 2) + oprot.writeString(self.delegationToken.encode('utf-8') if sys.version_info[0] == 2 else self.delegationToken) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCancelDelegationTokenReq(object): + """ + Attributes: + - sessionHandle + - delegationToken + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'delegationToken', 'UTF8', None, ), # 2 + ) + + def __init__(self, sessionHandle=None, delegationToken=None,): + self.sessionHandle = sessionHandle + self.delegationToken = delegationToken + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.delegationToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCancelDelegationTokenReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.delegationToken is not None: + oprot.writeFieldBegin('delegationToken', TType.STRING, 2) + oprot.writeString(self.delegationToken.encode('utf-8') if sys.version_info[0] == 2 else self.delegationToken) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + if self.delegationToken is None: + raise TProtocolException(message='Required field delegationToken is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TCancelDelegationTokenResp(object): + """ + Attributes: + - status + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + ) + + def __init__(self, status=None,): + self.status = status + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TCancelDelegationTokenResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TRenewDelegationTokenReq(object): + """ + Attributes: + - sessionHandle + - delegationToken + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'sessionHandle', (TSessionHandle, TSessionHandle.thrift_spec), None, ), # 1 + (2, TType.STRING, 'delegationToken', 'UTF8', None, ), # 2 + ) + + def __init__(self, sessionHandle=None, delegationToken=None,): + self.sessionHandle = sessionHandle + self.delegationToken = delegationToken + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.sessionHandle = TSessionHandle() + self.sessionHandle.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.delegationToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TRenewDelegationTokenReq') + if self.sessionHandle is not None: + oprot.writeFieldBegin('sessionHandle', TType.STRUCT, 1) + self.sessionHandle.write(oprot) + oprot.writeFieldEnd() + if self.delegationToken is not None: + oprot.writeFieldBegin('delegationToken', TType.STRING, 2) + oprot.writeString(self.delegationToken.encode('utf-8') if sys.version_info[0] == 2 else self.delegationToken) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.sessionHandle is None: + raise TProtocolException(message='Required field sessionHandle is unset!') + if self.delegationToken is None: + raise TProtocolException(message='Required field delegationToken is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TRenewDelegationTokenResp(object): + """ + Attributes: + - status + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + ) + + def __init__(self, status=None,): + self.status = status + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TRenewDelegationTokenResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class TGetLogReq(object): + """ + Attributes: + - operationHandle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'operationHandle', (TOperationHandle, TOperationHandle.thrift_spec), None, ), # 1 + ) + + def __init__(self, operationHandle=None,): + self.operationHandle = operationHandle + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.operationHandle = TOperationHandle() + self.operationHandle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetLogReq') + if self.operationHandle is not None: + oprot.writeFieldBegin('operationHandle', TType.STRUCT, 1) + self.operationHandle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.operationHandle is None: + raise TProtocolException(message='Required field operationHandle is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class TGetLogResp(object): + """ + Attributes: + - status + - log + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'status', (TStatus, TStatus.thrift_spec), None, ), # 1 + (2, TType.STRING, 'log', 'UTF8', None, ), # 2 + ) + + def __init__(self, status=None, log=None,): + self.status = status + self.log = log + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.status = TStatus() + self.status.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.log = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('TGetLogResp') + if self.status is not None: + oprot.writeFieldBegin('status', TType.STRUCT, 1) + self.status.write(oprot) + oprot.writeFieldEnd() + if self.log is not None: + oprot.writeFieldBegin('log', TType.STRING, 2) + oprot.writeString(self.log.encode('utf-8') if sys.version_info[0] == 2 else self.log) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.status is None: + raise TProtocolException(message='Required field status is unset!') + if self.log is None: + raise TProtocolException(message='Required field log is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) diff --git a/src/chronify/_vendor/kyuubi/pyhive/__init__.py b/src/chronify/_vendor/kyuubi/pyhive/__init__.py new file mode 100644 index 0000000..0a6bb1f --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/__init__.py @@ -0,0 +1,3 @@ +from __future__ import absolute_import +from __future__ import unicode_literals +__version__ = '0.7.0' diff --git a/src/chronify/_vendor/kyuubi/pyhive/common.py b/src/chronify/_vendor/kyuubi/pyhive/common.py new file mode 100644 index 0000000..51692b9 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/common.py @@ -0,0 +1,266 @@ +"""Package private common utilities. Do not use directly. + +Many docstrings in this file are based on PEP-249, which is in the public domain. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals +from builtins import bytes +from builtins import int +from builtins import object +from builtins import str +from past.builtins import basestring +from pyhive import exc +import abc +import collections +import time +import datetime +from future.utils import with_metaclass +from itertools import islice + +try: + from collections.abc import Iterable +except ImportError: + from collections import Iterable + + +class DBAPICursor(with_metaclass(abc.ABCMeta, object)): + """Base class for some common DB-API logic""" + + _STATE_NONE = 0 + _STATE_RUNNING = 1 + _STATE_FINISHED = 2 + + def __init__(self, poll_interval=1): + self._poll_interval = poll_interval + self._reset_state() + self.lastrowid = None + + def _reset_state(self): + """Reset state about the previous query in preparation for running another query""" + # State to return as part of DB-API + self._rownumber = 0 + + # Internal helper state + self._state = self._STATE_NONE + self._data = collections.deque() + self._columns = None + + def _fetch_while(self, fn): + while fn(): + self._fetch_more() + if fn(): + time.sleep(self._poll_interval) + + @abc.abstractproperty + def description(self): + raise NotImplementedError # pragma: no cover + + def close(self): + """By default, do nothing""" + pass + + @abc.abstractmethod + def _fetch_more(self): + """Get more results, append it to ``self._data``, and update ``self._state``.""" + raise NotImplementedError # pragma: no cover + + @property + def rowcount(self): + """By default, return -1 to indicate that this is not supported.""" + return -1 + + @abc.abstractmethod + def execute(self, operation, parameters=None): + """Prepare and execute a database operation (query or command). + + Parameters may be provided as sequence or mapping and will be bound to variables in the + operation. Variables are specified in a database-specific notation (see the module's + ``paramstyle`` attribute for details). + + Return values are not defined. + """ + raise NotImplementedError # pragma: no cover + + def executemany(self, operation, seq_of_parameters): + """Prepare a database operation (query or command) and then execute it against all parameter + sequences or mappings found in the sequence ``seq_of_parameters``. + + Only the final result set is retained. + + Return values are not defined. + """ + for parameters in seq_of_parameters[:-1]: + self.execute(operation, parameters) + while self._state != self._STATE_FINISHED: + self._fetch_more() + if seq_of_parameters: + self.execute(operation, seq_of_parameters[-1]) + + def fetchone(self): + """Fetch the next row of a query result set, returning a single sequence, or ``None`` when + no more data is available. + + An :py:class:`~pyhive.exc.Error` (or subclass) exception is raised if the previous call to + :py:meth:`execute` did not produce any result set or no call was issued yet. + """ + if self._state == self._STATE_NONE: + raise exc.ProgrammingError("No query yet") + + # Sleep until we're done or we have some data to return + self._fetch_while(lambda: not self._data and self._state != self._STATE_FINISHED) + + if not self._data: + return None + else: + self._rownumber += 1 + return self._data.popleft() + + def fetchmany(self, size=None): + """Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a + list of tuples). An empty sequence is returned when no more rows are available. + + The number of rows to fetch per call is specified by the parameter. If it is not given, the + cursor's arraysize determines the number of rows to be fetched. The method should try to + fetch as many rows as indicated by the size parameter. If this is not possible due to the + specified number of rows not being available, fewer rows may be returned. + + An :py:class:`~pyhive.exc.Error` (or subclass) exception is raised if the previous call to + :py:meth:`execute` did not produce any result set or no call was issued yet. + """ + if size is None: + size = self.arraysize + return list(islice(iter(self.fetchone, None), size)) + + def fetchall(self): + """Fetch all (remaining) rows of a query result, returning them as a sequence of sequences + (e.g. a list of tuples). + + An :py:class:`~pyhive.exc.Error` (or subclass) exception is raised if the previous call to + :py:meth:`execute` did not produce any result set or no call was issued yet. + """ + return list(iter(self.fetchone, None)) + + @property + def arraysize(self): + """This read/write attribute specifies the number of rows to fetch at a time with + :py:meth:`fetchmany`. It defaults to 1 meaning to fetch a single row at a time. + """ + return self._arraysize + + @arraysize.setter + def arraysize(self, value): + self._arraysize = value + + def setinputsizes(self, sizes): + """Does nothing by default""" + pass + + def setoutputsize(self, size, column=None): + """Does nothing by default""" + pass + + # + # Optional DB API Extensions + # + + @property + def rownumber(self): + """This read-only attribute should provide the current 0-based index of the cursor in the + result set. + + The index can be seen as index of the cursor in a sequence (the result set). The next fetch + operation will fetch the row indexed by ``rownumber`` in that sequence. + """ + return self._rownumber + + def __next__(self): + """Return the next row from the currently executing SQL statement using the same semantics + as :py:meth:`fetchone`. A ``StopIteration`` exception is raised when the result set is + exhausted. + """ + one = self.fetchone() + if one is None: + raise StopIteration + else: + return one + + next = __next__ + + def __iter__(self): + """Return self to make cursors compatible to the iteration protocol.""" + return self + + +class DBAPITypeObject(object): + # Taken from http://www.python.org/dev/peps/pep-0249/#implementation-hints + def __init__(self, *values): + self.values = values + + def __cmp__(self, other): + if other in self.values: + return 0 + if other < self.values: + return 1 + else: + return -1 + + +class ParamEscaper(object): + _DATE_FORMAT = "%Y-%m-%d" + _TIME_FORMAT = "%H:%M:%S.%f" + _DATETIME_FORMAT = "{} {}".format(_DATE_FORMAT, _TIME_FORMAT) + + def escape_args(self, parameters): + if isinstance(parameters, dict): + return {k: self.escape_item(v) for k, v in parameters.items()} + elif isinstance(parameters, (list, tuple)): + return tuple(self.escape_item(x) for x in parameters) + else: + raise exc.ProgrammingError("Unsupported param format: {}".format(parameters)) + + def escape_number(self, item): + return item + + def escape_string(self, item): + # Need to decode UTF-8 because of old sqlalchemy. + # Newer SQLAlchemy checks dialect.supports_unicode_binds before encoding Unicode strings + # as byte strings. The old version always encodes Unicode as byte strings, which breaks + # string formatting here. + if isinstance(item, bytes): + item = item.decode('utf-8') + # This is good enough when backslashes are literal, newlines are just followed, and the way + # to escape a single quote is to put two single quotes. + # (i.e. only special character is single quote) + return "'{}'".format(item.replace("'", "''")) + + def escape_sequence(self, item): + l = map(str, map(self.escape_item, item)) + return '(' + ','.join(l) + ')' + + def escape_datetime(self, item, format, cutoff=0): + dt_str = item.strftime(format) + formatted = dt_str[:-cutoff] if cutoff and format.endswith(".%f") else dt_str + return "'{}'".format(formatted) + + def escape_item(self, item): + if item is None: + return 'NULL' + elif isinstance(item, (int, float)): + return self.escape_number(item) + elif isinstance(item, basestring): + return self.escape_string(item) + elif isinstance(item, Iterable): + return self.escape_sequence(item) + elif isinstance(item, datetime.datetime): + return self.escape_datetime(item, self._DATETIME_FORMAT) + elif isinstance(item, datetime.date): + return self.escape_datetime(item, self._DATE_FORMAT) + else: + raise exc.ProgrammingError("Unsupported object {}".format(item)) + + +class UniversalSet(object): + """set containing everything""" + def __contains__(self, item): + return True diff --git a/src/chronify/_vendor/kyuubi/pyhive/exc.py b/src/chronify/_vendor/kyuubi/pyhive/exc.py new file mode 100644 index 0000000..931cf21 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/exc.py @@ -0,0 +1,72 @@ +""" +Package private common utilities. Do not use directly. +""" +from __future__ import absolute_import +from __future__ import unicode_literals + +__all__ = [ + 'Error', 'Warning', 'InterfaceError', 'DatabaseError', 'InternalError', 'OperationalError', + 'ProgrammingError', 'DataError', 'NotSupportedError', +] + + +class Error(Exception): + """Exception that is the base class of all other error exceptions. + + You can use this to catch all errors with one single except statement. + """ + pass + + +class Warning(Exception): + """Exception raised for important warnings like data truncations while inserting, etc.""" + pass + + +class InterfaceError(Error): + """Exception raised for errors that are related to the database interface rather than the + database itself. + """ + pass + + +class DatabaseError(Error): + """Exception raised for errors that are related to the database.""" + pass + + +class InternalError(DatabaseError): + """Exception raised when the database encounters an internal error, e.g. the cursor is not valid + anymore, the transaction is out of sync, etc.""" + pass + + +class OperationalError(DatabaseError): + """Exception raised for errors that are related to the database's operation and not necessarily + under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name + is not found, a transaction could not be processed, a memory allocation error occurred during + processing, etc. + """ + pass + + +class ProgrammingError(DatabaseError): + """Exception raised for programming errors, e.g. table not found or already exists, syntax error + in the SQL statement, wrong number of parameters specified, etc. + """ + pass + + +class DataError(DatabaseError): + """Exception raised for errors that are due to problems with the processed data like division by + zero, numeric value out of range, etc. + """ + pass + + +class NotSupportedError(DatabaseError): + """Exception raised in case a method or database API was used which is not supported by the + database, e.g. requesting a ``.rollback()`` on a connection that does not support transaction or + has transactions turned off. + """ + pass diff --git a/src/chronify/_vendor/kyuubi/pyhive/hive.py b/src/chronify/_vendor/kyuubi/pyhive/hive.py new file mode 100644 index 0000000..d6f8080 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/hive.py @@ -0,0 +1,620 @@ +"""DB-API implementation backed by HiveServer2 (Thrift API) + +See http://www.python.org/dev/peps/pep-0249/ + +Many docstrings in this file are based on the PEP, which is in the public domain. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals + +import base64 +import datetime +import re +from decimal import Decimal +from ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED, create_default_context + + +from TCLIService import TCLIService +from TCLIService import constants +from TCLIService import ttypes +from pyhive import common +from pyhive.common import DBAPITypeObject +# Make all exceptions visible in this module per DB-API +from pyhive.exc import * # noqa +from builtins import range +import contextlib +from future.utils import iteritems +import getpass +import logging +import sys +import thrift.transport.THttpClient +import thrift.protocol.TBinaryProtocol +import thrift.transport.TSocket +import thrift.transport.TTransport + +# PEP 249 module globals +apilevel = '2.0' +threadsafety = 2 # Threads may share the module and connections. +paramstyle = 'pyformat' # Python extended format codes, e.g. ...WHERE name=%(name)s + +_logger = logging.getLogger(__name__) + +_TIMESTAMP_PATTERN = re.compile(r'(\d+-\d+-\d+ \d+:\d+:\d+(\.\d{,6})?)') + +ssl_cert_parameter_map = { + "none": CERT_NONE, + "optional": CERT_OPTIONAL, + "required": CERT_REQUIRED, +} + + +def get_sasl_client(host, sasl_auth, service=None, username=None, password=None): + import sasl + sasl_client = sasl.Client() + sasl_client.setAttr('host', host) + + if sasl_auth == 'GSSAPI': + sasl_client.setAttr('service', service) + elif sasl_auth == 'PLAIN': + sasl_client.setAttr('username', username) + sasl_client.setAttr('password', password) + else: + raise ValueError("sasl_auth only supports GSSAPI and PLAIN") + + sasl_client.init() + return sasl_client + + +def get_pure_sasl_client(host, sasl_auth, service=None, username=None, password=None): + from pyhive.sasl_compat import PureSASLClient + + if sasl_auth == 'GSSAPI': + sasl_kwargs = {'service': service} + elif sasl_auth == 'PLAIN': + sasl_kwargs = {'username': username, 'password': password} + else: + raise ValueError("sasl_auth only supports GSSAPI and PLAIN") + + return PureSASLClient(host=host, **sasl_kwargs) + + +def get_installed_sasl(host, sasl_auth, service=None, username=None, password=None): + try: + return get_sasl_client(host=host, sasl_auth=sasl_auth, service=service, username=username, password=password) + # The sasl library is available + except ImportError: + # Fallback to pure-sasl library + return get_pure_sasl_client(host=host, sasl_auth=sasl_auth, service=service, username=username, password=password) + + +def _parse_timestamp(value): + if value: + match = _TIMESTAMP_PATTERN.match(value) + if match: + if match.group(2): + format = '%Y-%m-%d %H:%M:%S.%f' + # use the pattern to truncate the value + value = match.group() + else: + format = '%Y-%m-%d %H:%M:%S' + value = datetime.datetime.strptime(value, format) + else: + raise Exception( + 'Cannot convert "{}" into a datetime'.format(value)) + else: + value = None + return value + + +TYPES_CONVERTER = {"DECIMAL_TYPE": Decimal, + "TIMESTAMP_TYPE": _parse_timestamp} + + +class HiveParamEscaper(common.ParamEscaper): + def escape_string(self, item): + # backslashes and single quotes need to be escaped + # TODO verify against parser + # Need to decode UTF-8 because of old sqlalchemy. + # Newer SQLAlchemy checks dialect.supports_unicode_binds before encoding Unicode strings + # as byte strings. The old version always encodes Unicode as byte strings, which breaks + # string formatting here. + if isinstance(item, bytes): + item = item.decode('utf-8') + return "'{}'".format( + item + .replace('\\', '\\\\') + .replace("'", "\\'") + .replace('\r', '\\r') + .replace('\n', '\\n') + .replace('\t', '\\t') + ) + + +_escaper = HiveParamEscaper() + + +def connect(*args, **kwargs): + """Constructor for creating a connection to the database. See class :py:class:`Connection` for + arguments. + + :returns: a :py:class:`Connection` object. + """ + return Connection(*args, **kwargs) + + +class Connection(object): + """Wraps a Thrift session""" + + def __init__( + self, + host=None, + port=None, + scheme=None, + username=None, + database='default', + auth=None, + configuration=None, + kerberos_service_name=None, + password=None, + check_hostname=None, + ssl_cert=None, + thrift_transport=None, + ssl_context=None + ): + """Connect to HiveServer2 + + :param host: What host HiveServer2 runs on + :param port: What port HiveServer2 runs on. Defaults to 10000. + :param auth: The value of hive.server2.authentication used by HiveServer2. + Defaults to ``NONE``. + :param configuration: A dictionary of Hive settings (functionally same as the `set` command) + :param kerberos_service_name: Use with auth='KERBEROS' only + :param password: Use with auth='LDAP' or auth='CUSTOM' only + :param thrift_transport: A ``TTransportBase`` for custom advanced usage. + Incompatible with host, port, auth, kerberos_service_name, and password. + :param ssl_context: A custom SSL context to use for HTTPS connections. If provided, + this overrides check_hostname and ssl_cert parameters. + The way to support LDAP and GSSAPI is originated from cloudera/Impyla: + https://github.com/cloudera/impyla/blob/255b07ed973d47a3395214ed92d35ec0615ebf62 + /impala/_thrift_api.py#L152-L160 + """ + if scheme in ("https", "http") and thrift_transport is None: + port = port or 1000 + if scheme == "https": + if ssl_context is None: + ssl_context = create_default_context() + ssl_context.check_hostname = check_hostname == "true" + ssl_cert = ssl_cert or "none" + ssl_context.verify_mode = ssl_cert_parameter_map.get(ssl_cert, CERT_NONE) + thrift_transport = thrift.transport.THttpClient.THttpClient( + uri_or_host="{scheme}://{host}:{port}/cliservice/".format( + scheme=scheme, host=host, port=port + ), + ssl_context=ssl_context, + ) + + if auth in ("BASIC", "NOSASL", "NONE", None): + # Always needs the Authorization header + self._set_authorization_header(thrift_transport, username, password) + elif auth == "KERBEROS" and kerberos_service_name: + self._set_kerberos_header(thrift_transport, kerberos_service_name, host) + else: + raise ValueError( + "Authentication is not valid use one of:" + "BASIC, NOSASL, KERBEROS, NONE" + ) + host, port, auth, kerberos_service_name, password = ( + None, None, None, None, None + ) + + username = username or getpass.getuser() + configuration = configuration or {} + + if (password is not None) != (auth in ('LDAP', 'CUSTOM')): + raise ValueError("Password should be set if and only if in LDAP or CUSTOM mode; " + "Remove password or use one of those modes") + if (kerberos_service_name is not None) != (auth == 'KERBEROS'): + raise ValueError("kerberos_service_name should be set if and only if in KERBEROS mode") + if thrift_transport is not None: + has_incompatible_arg = ( + host is not None + or port is not None + or auth is not None + or kerberos_service_name is not None + or password is not None + ) + if has_incompatible_arg: + raise ValueError("thrift_transport cannot be used with " + "host/port/auth/kerberos_service_name/password") + + if thrift_transport is not None: + self._transport = thrift_transport + else: + if port is None: + port = 10000 + if auth is None: + auth = 'NONE' + socket = thrift.transport.TSocket.TSocket(host, port) + if auth == 'NOSASL': + # NOSASL corresponds to hive.server2.authentication=NOSASL in hive-site.xml + self._transport = thrift.transport.TTransport.TBufferedTransport(socket) + elif auth in ('LDAP', 'KERBEROS', 'NONE', 'CUSTOM'): + # Defer import so package dependency is optional + import thrift_sasl + + if auth == 'KERBEROS': + # KERBEROS mode in hive.server2.authentication is GSSAPI in sasl library + sasl_auth = 'GSSAPI' + else: + sasl_auth = 'PLAIN' + if password is None: + # Password doesn't matter in NONE mode, just needs to be nonempty. + password = 'x' + + self._transport = thrift_sasl.TSaslClientTransport(lambda: get_installed_sasl(host=host, sasl_auth=sasl_auth, service=kerberos_service_name, username=username, password=password), sasl_auth, socket) + else: + # All HS2 config options: + # https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-Configuration + # PAM currently left to end user via thrift_transport option. + raise NotImplementedError( + "Only NONE, NOSASL, LDAP, KERBEROS, CUSTOM " + "authentication are supported, got {}".format(auth)) + + protocol = thrift.protocol.TBinaryProtocol.TBinaryProtocol(self._transport) + self._client = TCLIService.Client(protocol) + # oldest version that still contains features we care about + # "V6 uses binary type for binary payload (was string) and uses columnar result set" + protocol_version = ttypes.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6 + + try: + self._transport.open() + open_session_req = ttypes.TOpenSessionReq( + client_protocol=protocol_version, + configuration=configuration, + username=username, + ) + response = self._client.OpenSession(open_session_req) + _check_status(response) + assert response.sessionHandle is not None, "Expected a session from OpenSession" + self._sessionHandle = response.sessionHandle + assert response.serverProtocolVersion == protocol_version, \ + "Unable to handle protocol version {}".format(response.serverProtocolVersion) + with contextlib.closing(self.cursor()) as cursor: + cursor.execute('USE `{}`'.format(database)) + except: + self._transport.close() + raise + + @staticmethod + def _set_authorization_header(transport, username=None, password=None): + username = username or "user" + password = password or "pass" + auth_credentials = "{username}:{password}".format( + username=username, password=password + ).encode("UTF-8") + auth_credentials_base64 = base64.standard_b64encode(auth_credentials).decode( + "UTF-8" + ) + transport.setCustomHeaders( + { + "Authorization": "Basic {auth_credentials_base64}".format( + auth_credentials_base64=auth_credentials_base64 + ) + } + ) + + @staticmethod + def _set_kerberos_header(transport, kerberos_service_name, host): + import kerberos + + __, krb_context = kerberos.authGSSClientInit( + service="{kerberos_service_name}@{host}".format( + kerberos_service_name=kerberos_service_name, host=host + ) + ) + kerberos.authGSSClientClean(krb_context, "") + kerberos.authGSSClientStep(krb_context, "") + auth_header = kerberos.authGSSClientResponse(krb_context) + + transport.setCustomHeaders( + { + "Authorization": "Negotiate {auth_header}".format( + auth_header=auth_header + ) + } + ) + + def __enter__(self): + """Transport should already be opened by __init__""" + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + """Call close""" + self.close() + + def close(self): + """Close the underlying session and Thrift transport""" + req = ttypes.TCloseSessionReq(sessionHandle=self._sessionHandle) + response = self._client.CloseSession(req) + self._transport.close() + _check_status(response) + + def commit(self): + """Hive does not support transactions, so this does nothing.""" + pass + + def cursor(self, *args, **kwargs): + """Return a new :py:class:`Cursor` object using the connection.""" + return Cursor(self, *args, **kwargs) + + @property + def client(self): + return self._client + + @property + def sessionHandle(self): + return self._sessionHandle + + def rollback(self): + raise NotSupportedError("Hive does not have transactions") # pragma: no cover + + +class Cursor(common.DBAPICursor): + """These objects represent a database cursor, which is used to manage the context of a fetch + operation. + + Cursors are not isolated, i.e., any changes done to the database by a cursor are immediately + visible by other cursors or connections. + """ + + def __init__(self, connection, arraysize=1000): + self._operationHandle = None + super(Cursor, self).__init__() + self._arraysize = arraysize + self._connection = connection + + def _reset_state(self): + """Reset state about the previous query in preparation for running another query""" + super(Cursor, self)._reset_state() + self._description = None + if self._operationHandle is not None: + request = ttypes.TCloseOperationReq(self._operationHandle) + try: + response = self._connection.client.CloseOperation(request) + _check_status(response) + finally: + self._operationHandle = None + + @property + def arraysize(self): + return self._arraysize + + @arraysize.setter + def arraysize(self, value): + """Array size cannot be None, and should be an integer""" + default_arraysize = 1000 + try: + self._arraysize = int(value) or default_arraysize + except TypeError: + self._arraysize = default_arraysize + + @property + def description(self): + """This read-only attribute is a sequence of 7-item sequences. + + Each of these sequences contains information describing one result column: + + - name + - type_code + - display_size (None in current implementation) + - internal_size (None in current implementation) + - precision (None in current implementation) + - scale (None in current implementation) + - null_ok (always True in current implementation) + + This attribute will be ``None`` for operations that do not return rows or if the cursor has + not had an operation invoked via the :py:meth:`execute` method yet. + + The ``type_code`` can be interpreted by comparing it to the Type Objects specified in the + section below. + """ + if self._operationHandle is None or not self._operationHandle.hasResultSet: + return None + if self._description is None: + req = ttypes.TGetResultSetMetadataReq(self._operationHandle) + response = self._connection.client.GetResultSetMetadata(req) + _check_status(response) + columns = response.schema.columns + self._description = [] + for col in columns: + primary_type_entry = col.typeDesc.types[0] + if primary_type_entry.primitiveEntry is None: + # All fancy stuff maps to string + type_code = ttypes.TTypeId._VALUES_TO_NAMES[ttypes.TTypeId.STRING_TYPE] + else: + type_id = primary_type_entry.primitiveEntry.type + try: + type_code = ttypes.TTypeId._VALUES_TO_NAMES[type_id] + except KeyError: + type_code = None + self._description.append(( + col.columnName.decode('utf-8') if sys.version_info[0] == 2 else col.columnName, + type_code.decode('utf-8') if sys.version_info[0] == 2 else type_code, + None, None, None, None, True + )) + return self._description + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def close(self): + """Close the operation handle""" + self._reset_state() + + def execute(self, operation, parameters=None, **kwargs): + """Prepare and execute a database operation (query or command). + + Return values are not defined. + """ + # backward compatibility with Python < 3.7 + for kw in ['async', 'async_']: + if kw in kwargs: + async_ = kwargs[kw] + break + else: + async_ = False + + # Prepare statement + if parameters is None: + sql = operation + else: + sql = operation % _escaper.escape_args(parameters) + + self._reset_state() + + self._state = self._STATE_RUNNING + _logger.info('%s', sql) + + req = ttypes.TExecuteStatementReq(self._connection.sessionHandle, + sql, runAsync=async_) + _logger.debug(req) + response = self._connection.client.ExecuteStatement(req) + _check_status(response) + self._operationHandle = response.operationHandle + + def cancel(self): + req = ttypes.TCancelOperationReq( + operationHandle=self._operationHandle, + ) + response = self._connection.client.CancelOperation(req) + _check_status(response) + + def _fetch_more(self): + """Send another TFetchResultsReq and update state""" + assert(self._state == self._STATE_RUNNING), "Should be running when in _fetch_more" + assert(self._operationHandle is not None), "Should have an op handle in _fetch_more" + if not self._operationHandle.hasResultSet: + raise ProgrammingError("No result set") + req = ttypes.TFetchResultsReq( + operationHandle=self._operationHandle, + orientation=ttypes.TFetchOrientation.FETCH_NEXT, + maxRows=self.arraysize, + ) + response = self._connection.client.FetchResults(req) + _check_status(response) + schema = self.description + assert not response.results.rows, 'expected data in columnar format' + has_new_data = False + if response.results.columns: + columns = [_unwrap_column(col, col_schema[1]) for col, col_schema in + zip(response.results.columns, schema)] + new_data = list(zip(*columns)) + self._data += new_data + has_new_data = (True if new_data else False) + # response.hasMoreRows seems to always be False, so we instead check the number of rows + # https://github.com/apache/hive/blob/release-1.2.1/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L678 + # if not response.hasMoreRows: + if not has_new_data: + self._state = self._STATE_FINISHED + + def poll(self, get_progress_update=True): + """Poll for and return the raw status data provided by the Hive Thrift REST API. + :returns: ``ttypes.TGetOperationStatusResp`` + :raises: ``ProgrammingError`` when no query has been started + .. note:: + This is not a part of DB-API. + """ + if self._state == self._STATE_NONE: + raise ProgrammingError("No query yet") + + req = ttypes.TGetOperationStatusReq( + operationHandle=self._operationHandle, + getProgressUpdate=get_progress_update, + ) + response = self._connection.client.GetOperationStatus(req) + _check_status(response) + + return response + + def fetch_logs(self): + """Retrieve the logs produced by the execution of the query. + Can be called multiple times to fetch the logs produced after the previous call. + :returns: list + :raises: ``ProgrammingError`` when no query has been started + .. note:: + This is not a part of DB-API. + """ + if self._state == self._STATE_NONE: + raise ProgrammingError("No query yet") + + try: # Older Hive instances require logs to be retrieved using GetLog + req = ttypes.TGetLogReq(operationHandle=self._operationHandle) + logs = self._connection.client.GetLog(req).log.splitlines() + except ttypes.TApplicationException as e: # Otherwise, retrieve logs using newer method + if e.type != ttypes.TApplicationException.UNKNOWN_METHOD: + raise + logs = [] + while True: + req = ttypes.TFetchResultsReq( + operationHandle=self._operationHandle, + orientation=ttypes.TFetchOrientation.FETCH_NEXT, + maxRows=self.arraysize, + fetchType=1 # 0: results, 1: logs + ) + response = self._connection.client.FetchResults(req) + _check_status(response) + assert not response.results.rows, 'expected data in columnar format' + new_logs = '' + if response.results.columns: + new_logs = _unwrap_column(response.results.columns[0]) + logs += new_logs + + if not new_logs: + break + + return logs + + +# +# Type Objects and Constructors +# + + +for type_id in constants.PRIMITIVE_TYPES: + name = ttypes.TTypeId._VALUES_TO_NAMES[type_id] + setattr(sys.modules[__name__], name, DBAPITypeObject([name])) + + +# +# Private utilities +# + + +def _unwrap_column(col, type_=None): + """Return a list of raw values from a TColumn instance.""" + for attr, wrapper in iteritems(col.__dict__): + if wrapper is not None: + result = wrapper.values + nulls = wrapper.nulls # bit set describing what's null + assert isinstance(nulls, bytes) + for i, char in enumerate(nulls): + byte = ord(char) if sys.version_info[0] == 2 else char + for b in range(8): + if byte & (1 << b): + result[i * 8 + b] = None + converter = TYPES_CONVERTER.get(type_, None) + if converter and type_: + result = [converter(row) if row else row for row in result] + return result + raise DataError("Got empty column value {}".format(col)) # pragma: no cover + + +def _check_status(response): + """Raise an OperationalError if the status is not success""" + _logger.debug(response) + if response.status.statusCode != ttypes.TStatusCode.SUCCESS_STATUS: + raise OperationalError(response) diff --git a/src/chronify/_vendor/kyuubi/pyhive/presto.py b/src/chronify/_vendor/kyuubi/pyhive/presto.py new file mode 100644 index 0000000..3217f4c --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/presto.py @@ -0,0 +1,367 @@ +"""DB-API implementation backed by Presto + +See http://www.python.org/dev/peps/pep-0249/ + +Many docstrings in this file are based on the PEP, which is in the public domain. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals + +from builtins import object +from decimal import Decimal + +from pyhive import common +from pyhive.common import DBAPITypeObject +# Make all exceptions visible in this module per DB-API +from pyhive.exc import * # noqa +import base64 +import getpass +import datetime +import logging +import requests +from requests.auth import HTTPBasicAuth +import os + +try: # Python 3 + import urllib.parse as urlparse +except ImportError: # Python 2 + import urlparse + + +# PEP 249 module globals +apilevel = '2.0' +threadsafety = 2 # Threads may share the module and connections. +paramstyle = 'pyformat' # Python extended format codes, e.g. ...WHERE name=%(name)s + +_logger = logging.getLogger(__name__) + +TYPES_CONVERTER = { + "decimal": Decimal, + # As of Presto 0.69, binary data is returned as the varbinary type in base64 format + "varbinary": base64.b64decode +} + +class PrestoParamEscaper(common.ParamEscaper): + def escape_datetime(self, item, format): + _type = "timestamp" if isinstance(item, datetime.datetime) else "date" + formatted = super(PrestoParamEscaper, self).escape_datetime(item, format, 3) + return "{} {}".format(_type, formatted) + + +_escaper = PrestoParamEscaper() + + +def connect(*args, **kwargs): + """Constructor for creating a connection to the database. See class :py:class:`Connection` for + arguments. + + :returns: a :py:class:`Connection` object. + """ + return Connection(*args, **kwargs) + + +class Connection(object): + """Presto does not have a notion of a persistent connection. + + Thus, these objects are small stateless factories for cursors, which do all the real work. + """ + + def __init__(self, *args, **kwargs): + self._args = args + self._kwargs = kwargs + + def close(self): + """Presto does not have anything to close""" + # TODO cancel outstanding queries? + pass + + def commit(self): + """Presto does not support transactions""" + pass + + def cursor(self): + """Return a new :py:class:`Cursor` object using the connection.""" + return Cursor(*self._args, **self._kwargs) + + def rollback(self): + raise NotSupportedError("Presto does not have transactions") # pragma: no cover + + +class Cursor(common.DBAPICursor): + """These objects represent a database cursor, which is used to manage the context of a fetch + operation. + + Cursors are not isolated, i.e., any changes done to the database by a cursor are immediately + visible by other cursors or connections. + """ + + def __init__(self, host, port='8080', username=None, principal_username=None, catalog='hive', + schema='default', poll_interval=1, source='pyhive', session_props=None, + protocol='http', password=None, requests_session=None, requests_kwargs=None, + KerberosRemoteServiceName=None, KerberosPrincipal=None, + KerberosConfigPath=None, KerberosKeytabPath=None, + KerberosCredentialCachePath=None, KerberosUseCanonicalHostname=None): + """ + :param host: hostname to connect to, e.g. ``presto.example.com`` + :param port: int -- port, defaults to 8080 + :param username: string -- defaults to system user name + :param principal_username: string -- defaults to ``username`` argument if it exists, + else defaults to system user name + :param catalog: string -- defaults to ``hive`` + :param schema: string -- defaults to ``default`` + :param poll_interval: float -- how often to ask the Presto REST interface for a progress + update, defaults to a second + :param source: string -- arbitrary identifier (shows up in the Presto monitoring page) + :param protocol: string -- network protocol, valid options are ``http`` and ``https``. + defaults to ``http`` + :param password: string -- Deprecated. Defaults to ``None``. + Using BasicAuth, requires ``https``. + Prefer ``requests_kwargs={'auth': HTTPBasicAuth(username, password)}``. + May not be specified with ``requests_kwargs['auth']``. + :param requests_session: a ``requests.Session`` object for advanced usage. If absent, this + class will use the default requests behavior of making a new session per HTTP request. + Caller is responsible for closing session. + :param requests_kwargs: Additional ``**kwargs`` to pass to requests + :param KerberosRemoteServiceName: string -- Presto coordinator Kerberos service name. + This parameter is required for Kerberos authentiation. + :param KerberosPrincipal: string -- The principal to use when authenticating to + the Presto coordinator. + :param KerberosConfigPath: string -- Kerberos configuration file. + (default: /etc/krb5.conf) + :param KerberosKeytabPath: string -- Kerberos keytab file. + :param KerberosCredentialCachePath: string -- Kerberos credential cache. + :param KerberosUseCanonicalHostname: boolean -- Use the canonical hostname of the + Presto coordinator for the Kerberos service principal by first resolving the + hostname to an IP address and then doing a reverse DNS lookup for that IP address. + This is enabled by default. + """ + super(Cursor, self).__init__(poll_interval) + # Config + self._host = host + self._port = port + """ + Presto User Impersonation: https://docs.starburstdata.com/latest/security/impersonation.html + + User impersonation allows the execution of queries in Presto based on principal_username + argument, instead of executing the query as the account which authenticated against Presto. + (Usually a service account) + + Allows for a service account to authenticate with Presto, and then leverage the + principal_username as the user Presto will execute the query as. This is required by + applications that leverage authentication methods like SAML, where the application has a + username, but not a password to still leverage user specific Presto Resource Groups and + Authorization rules that would not be applied when only using a shared service account. + This also allows auditing of who is executing a query in these environments, instead of + having all queryes run by the shared service account. + """ + self._username = principal_username or username or getpass.getuser() + self._catalog = catalog + self._schema = schema + self._arraysize = 1 + self._poll_interval = poll_interval + self._source = source + self._session_props = session_props if session_props is not None else {} + self.last_query_id = None + + if protocol not in ('http', 'https'): + raise ValueError("Protocol must be http/https, was {!r}".format(protocol)) + self._protocol = protocol + + self._requests_session = requests_session or requests + + requests_kwargs = dict(requests_kwargs) if requests_kwargs is not None else {} + + if KerberosRemoteServiceName is not None: + from requests_kerberos import HTTPKerberosAuth, OPTIONAL + + hostname_override = None + if KerberosUseCanonicalHostname is not None \ + and KerberosUseCanonicalHostname.lower() == 'false': + hostname_override = host + if KerberosConfigPath is not None: + os.environ['KRB5_CONFIG'] = KerberosConfigPath + if KerberosKeytabPath is not None: + os.environ['KRB5_CLIENT_KTNAME'] = KerberosKeytabPath + if KerberosCredentialCachePath is not None: + os.environ['KRB5CCNAME'] = KerberosCredentialCachePath + + requests_kwargs['auth'] = HTTPKerberosAuth(mutual_authentication=OPTIONAL, + principal=KerberosPrincipal, + service=KerberosRemoteServiceName, + hostname_override=hostname_override) + + else: + if password is not None and 'auth' in requests_kwargs: + raise ValueError("Cannot use both password and requests_kwargs authentication") + for k in ('method', 'url', 'data', 'headers'): + if k in requests_kwargs: + raise ValueError("Cannot override requests argument {}".format(k)) + if password is not None: + requests_kwargs['auth'] = HTTPBasicAuth(username, password) + if protocol != 'https': + raise ValueError("Protocol must be https when passing a password") + self._requests_kwargs = requests_kwargs + + self._reset_state() + + def _reset_state(self): + """Reset state about the previous query in preparation for running another query""" + super(Cursor, self)._reset_state() + self._nextUri = None + self._columns = None + + @property + def description(self): + """This read-only attribute is a sequence of 7-item sequences. + + Each of these sequences contains information describing one result column: + + - name + - type_code + - display_size (None in current implementation) + - internal_size (None in current implementation) + - precision (None in current implementation) + - scale (None in current implementation) + - null_ok (always True in current implementation) + + The ``type_code`` can be interpreted by comparing it to the Type Objects specified in the + section below. + """ + # Sleep until we're done or we got the columns + self._fetch_while( + lambda: self._columns is None and + self._state not in (self._STATE_NONE, self._STATE_FINISHED) + ) + if self._columns is None: + return None + return [ + # name, type_code, display_size, internal_size, precision, scale, null_ok + (col['name'], col['type'], None, None, None, None, True) + for col in self._columns + ] + + def execute(self, operation, parameters=None): + """Prepare and execute a database operation (query or command). + + Return values are not defined. + """ + headers = { + 'X-Presto-Catalog': self._catalog, + 'X-Presto-Schema': self._schema, + 'X-Presto-Source': self._source, + 'X-Presto-User': self._username, + } + + if self._session_props: + headers['X-Presto-Session'] = ','.join( + '{}={}'.format(propname, propval) + for propname, propval in self._session_props.items() + ) + + # Prepare statement + if parameters is None: + sql = operation + else: + sql = operation % _escaper.escape_args(parameters) + + self._reset_state() + + self._state = self._STATE_RUNNING + url = urlparse.urlunparse(( + self._protocol, + '{}:{}'.format(self._host, self._port), '/v1/statement', None, None, None)) + _logger.info('%s', sql) + _logger.debug("Headers: %s", headers) + response = self._requests_session.post( + url, data=sql.encode('utf-8'), headers=headers, **self._requests_kwargs) + self._process_response(response) + + def cancel(self): + if self._state == self._STATE_NONE: + raise ProgrammingError("No query yet") + if self._nextUri is None: + assert self._state == self._STATE_FINISHED, "Should be finished if nextUri is None" + return + + response = self._requests_session.delete(self._nextUri, **self._requests_kwargs) + if response.status_code != requests.codes.no_content: + fmt = "Unexpected status code after cancel {}\n{}" + raise OperationalError(fmt.format(response.status_code, response.content)) + + self._state = self._STATE_FINISHED + self._nextUri = None + + def poll(self): + """Poll for and return the raw status data provided by the Presto REST API. + + :returns: dict -- JSON status information or ``None`` if the query is done + :raises: ``ProgrammingError`` when no query has been started + + .. note:: + This is not a part of DB-API. + """ + if self._state == self._STATE_NONE: + raise ProgrammingError("No query yet") + if self._nextUri is None: + assert self._state == self._STATE_FINISHED, "Should be finished if nextUri is None" + return None + response = self._requests_session.get(self._nextUri, **self._requests_kwargs) + self._process_response(response) + return response.json() + + def _fetch_more(self): + """Fetch the next URI and update state""" + self._process_response(self._requests_session.get(self._nextUri, **self._requests_kwargs)) + + def _process_data(self, rows): + for i, col in enumerate(self.description): + col_type = col[1].split("(")[0].lower() + if col_type in TYPES_CONVERTER: + for row in rows: + if row[i] is not None: + row[i] = TYPES_CONVERTER[col_type](row[i]) + + def _process_response(self, response): + """Given the JSON response from Presto's REST API, update the internal state with the next + URI and any data from the response + """ + # TODO handle HTTP 503 + if response.status_code != requests.codes.ok: + fmt = "Unexpected status code {}\n{}" + raise OperationalError(fmt.format(response.status_code, response.content)) + + response_json = response.json() + _logger.debug("Got response %s", response_json) + assert self._state == self._STATE_RUNNING, "Should be running if processing response" + self._nextUri = response_json.get('nextUri') + self._columns = response_json.get('columns') + if 'id' in response_json: + self.last_query_id = response_json['id'] + if 'X-Presto-Clear-Session' in response.headers: + propname = response.headers['X-Presto-Clear-Session'] + self._session_props.pop(propname, None) + if 'X-Presto-Set-Session' in response.headers: + propname, propval = response.headers['X-Presto-Set-Session'].split('=', 1) + self._session_props[propname] = propval + if 'data' in response_json: + assert self._columns + new_data = response_json['data'] + self._process_data(new_data) + self._data += map(tuple, new_data) + if 'nextUri' not in response_json: + self._state = self._STATE_FINISHED + if 'error' in response_json: + raise DatabaseError(response_json['error']) + + +# +# Type Objects and Constructors +# + + +# See types in presto-main/src/main/java/com/facebook/presto/tuple/TupleInfo.java +FIXED_INT_64 = DBAPITypeObject(['bigint']) +VARIABLE_BINARY = DBAPITypeObject(['varchar']) +DOUBLE = DBAPITypeObject(['double']) +BOOLEAN = DBAPITypeObject(['boolean']) diff --git a/src/chronify/_vendor/kyuubi/pyhive/sasl_compat.py b/src/chronify/_vendor/kyuubi/pyhive/sasl_compat.py new file mode 100644 index 0000000..19af6d2 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/sasl_compat.py @@ -0,0 +1,56 @@ +# Original source of this file is https://github.com/cloudera/impyla/blob/master/impala/sasl_compat.py +# which uses Apache-2.0 license as of 21 May 2023. +# This code was added to Impyla in 2016 as a compatibility layer to allow use of either python-sasl or pure-sasl +# via PR https://github.com/cloudera/impyla/pull/179 +# Even though thrift_sasl lists pure-sasl as dependency here https://github.com/cloudera/thrift_sasl/blob/master/setup.py#L34 +# but it still calls functions native to python-sasl in this file https://github.com/cloudera/thrift_sasl/blob/master/thrift_sasl/__init__.py#L82 +# Hence this code is required for the fallback to work. + + +from puresasl.client import SASLClient, SASLError +from contextlib import contextmanager + +@contextmanager +def error_catcher(self, Exc = Exception): + try: + self.error = None + yield + except Exc as e: + self.error = str(e) + + +class PureSASLClient(SASLClient): + def __init__(self, *args, **kwargs): + self.error = None + super(PureSASLClient, self).__init__(*args, **kwargs) + + def start(self, mechanism): + with error_catcher(self, SASLError): + if isinstance(mechanism, list): + self.choose_mechanism(mechanism) + else: + self.choose_mechanism([mechanism]) + return True, self.mechanism, self.process() + # else + return False, mechanism, None + + def encode(self, incoming): + with error_catcher(self): + return True, self.unwrap(incoming) + # else + return False, None + + def decode(self, outgoing): + with error_catcher(self): + return True, self.wrap(outgoing) + # else + return False, None + + def step(self, challenge=None): + with error_catcher(self): + return True, self.process(challenge) + # else + return False, None + + def getError(self): + return self.error diff --git a/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_hive.py b/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_hive.py new file mode 100644 index 0000000..66f7d75 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_hive.py @@ -0,0 +1,435 @@ +"""Integration between SQLAlchemy and Hive. + +Some code based on +https://github.com/zzzeek/sqlalchemy/blob/rel_0_5/lib/sqlalchemy/databases/sqlite.py +which is released under the MIT license. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals + +import datetime +import decimal +import logging + +import re +from sqlalchemy import exc +from sqlalchemy.sql import text +try: + from sqlalchemy import processors +except ImportError: + # Required for SQLAlchemy>=2.0 + from sqlalchemy.engine import processors +from sqlalchemy import types +from sqlalchemy import util +# TODO shouldn't use mysql type +try: + from sqlalchemy.databases import mysql + mysql_tinyinteger = mysql.MSTinyInteger +except ImportError: + # Required for SQLAlchemy>2.0 + from sqlalchemy.dialects import mysql + mysql_tinyinteger = mysql.base.MSTinyInteger +from sqlalchemy.engine import default +from sqlalchemy.sql import compiler +from sqlalchemy.sql.compiler import SQLCompiler + +from pyhive import hive +from pyhive.common import UniversalSet + +from dateutil.parser import parse +from decimal import Decimal + +_logger = logging.getLogger(__name__) + +class HiveStringTypeBase(types.TypeDecorator): + """Translates strings returned by Thrift into something else""" + impl = types.String + + def process_bind_param(self, value, dialect): + raise NotImplementedError("Writing to Hive not supported") + + +class HiveDate(HiveStringTypeBase): + """Translates date strings to date objects""" + impl = types.DATE + + def process_result_value(self, value, dialect): + return processors.str_to_date(value) + + def result_processor(self, dialect, coltype): + def process(value): + if isinstance(value, datetime.datetime): + return value.date() + elif isinstance(value, datetime.date): + return value + elif value is not None: + return parse(value).date() + else: + return None + + return process + + def adapt(self, impltype, **kwargs): + return self.impl + + +class HiveTimestamp(HiveStringTypeBase): + """Translates timestamp strings to datetime objects""" + impl = types.TIMESTAMP + + def process_result_value(self, value, dialect): + return processors.str_to_datetime(value) + + def result_processor(self, dialect, coltype): + def process(value): + if isinstance(value, datetime.datetime): + return value + elif value is not None: + return parse(value) + else: + return None + + return process + + def adapt(self, impltype, **kwargs): + return self.impl + + +class HiveDecimal(HiveStringTypeBase): + """Translates strings to decimals""" + impl = types.DECIMAL + + def process_result_value(self, value, dialect): + if value is not None: + return decimal.Decimal(value) + else: + return None + + def result_processor(self, dialect, coltype): + def process(value): + if isinstance(value, Decimal): + return value + elif value is not None: + return Decimal(value) + else: + return None + + return process + + def adapt(self, impltype, **kwargs): + return self.impl + + +class HiveIdentifierPreparer(compiler.IdentifierPreparer): + # Just quote everything to make things simpler / easier to upgrade + reserved_words = UniversalSet() + + def __init__(self, dialect): + super(HiveIdentifierPreparer, self).__init__( + dialect, + initial_quote='`', + ) + + +_type_map = { + 'boolean': types.Boolean, + 'tinyint': mysql_tinyinteger, + 'smallint': types.SmallInteger, + 'int': types.Integer, + 'bigint': types.BigInteger, + 'float': types.Float, + 'double': types.Float, + 'string': types.String, + 'varchar': types.String, + 'char': types.String, + 'date': HiveDate, + 'timestamp': HiveTimestamp, + 'binary': types.String, + 'array': types.String, + 'map': types.String, + 'struct': types.String, + 'uniontype': types.String, + 'decimal': HiveDecimal, +} + + +class HiveCompiler(SQLCompiler): + def visit_concat_op_binary(self, binary, operator, **kw): + return "concat(%s, %s)" % (self.process(binary.left), self.process(binary.right)) + + def visit_insert(self, *args, **kwargs): + result = super(HiveCompiler, self).visit_insert(*args, **kwargs) + # Massage the result into Hive's format + # INSERT INTO `pyhive_test_database`.`test_table` (`a`) SELECT ... + # => + # INSERT INTO TABLE `pyhive_test_database`.`test_table` SELECT ... + regex = r'^(INSERT INTO) ([^\s]+) \([^\)]*\)' + assert re.search(regex, result), "Unexpected visit_insert result: {}".format(result) + return re.sub(regex, r'\1 TABLE \2', result) + + def visit_column(self, *args, **kwargs): + result = super(HiveCompiler, self).visit_column(*args, **kwargs) + dot_count = result.count('.') + assert dot_count in (0, 1, 2), "Unexpected visit_column result {}".format(result) + if dot_count == 2: + # we have something of the form schema.table.column + # hive doesn't like the schema in front, so chop it out + result = result[result.index('.') + 1:] + return result + + def visit_char_length_func(self, fn, **kw): + return 'length{}'.format(self.function_argspec(fn, **kw)) + + +class HiveTypeCompiler(compiler.GenericTypeCompiler): + def visit_INTEGER(self, type_): + return 'INT' + + def visit_NUMERIC(self, type_): + return 'DECIMAL' + + def visit_CHAR(self, type_): + return 'STRING' + + def visit_VARCHAR(self, type_): + return 'STRING' + + def visit_NCHAR(self, type_): + return 'STRING' + + def visit_TEXT(self, type_): + return 'STRING' + + def visit_CLOB(self, type_): + return 'STRING' + + def visit_BLOB(self, type_): + return 'BINARY' + + def visit_TIME(self, type_): + return 'TIMESTAMP' + + def visit_DATE(self, type_): + return 'TIMESTAMP' + + def visit_DATETIME(self, type_): + return 'TIMESTAMP' + + +class HiveExecutionContext(default.DefaultExecutionContext): + """This is pretty much the same as SQLiteExecutionContext to work around the same issue. + + http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#dotted-column-names + + engine = create_engine('hive://...', execution_options={'hive_raw_colnames': True}) + """ + + @util.memoized_property + def _preserve_raw_colnames(self): + # Ideally, this would also gate on hive.resultset.use.unique.column.names + return self.execution_options.get('hive_raw_colnames', False) + + def _translate_colname(self, colname): + # Adjust for dotted column names. + # When hive.resultset.use.unique.column.names is true (the default), Hive returns column + # names as "tablename.colname" in cursor.description. + if not self._preserve_raw_colnames and '.' in colname: + return colname.split('.')[-1], colname + else: + return colname, None + + +class HiveDialect(default.DefaultDialect): + name = 'hive' + driver = 'thrift' + execution_ctx_cls = HiveExecutionContext + preparer = HiveIdentifierPreparer + statement_compiler = HiveCompiler + supports_views = True + supports_alter = True + supports_pk_autoincrement = False + supports_default_values = False + supports_empty_insert = False + supports_native_decimal = True + supports_native_boolean = True + supports_unicode_statements = True + supports_unicode_binds = True + returns_unicode_strings = True + description_encoding = None + supports_multivalues_insert = True + type_compiler = HiveTypeCompiler + supports_sane_rowcount = False + supports_statement_cache = False + + @classmethod + def dbapi(cls): + return hive + + @classmethod + def import_dbapi(cls): + return hive + + def create_connect_args(self, url): + kwargs = { + 'host': url.host, + 'port': url.port or 10000, + 'username': url.username, + 'password': url.password, + 'database': url.database or 'default', + } + kwargs.update(url.query) + return [], kwargs + + def get_schema_names(self, connection, **kw): + # Equivalent to SHOW DATABASES + return [row[0] for row in connection.execute(text('SHOW SCHEMAS'))] + + def get_view_names(self, connection, schema=None, **kw): + # Hive does not provide functionality to query tableType + # This allows reflection to not crash at the cost of being inaccurate + return self.get_table_names(connection, schema, **kw) + + def _get_table_columns(self, connection, table_name, schema): + full_table = table_name + if schema: + full_table = schema + '.' + table_name + # TODO using TGetColumnsReq hangs after sending TFetchResultsReq. + # Using DESCRIBE works but is uglier. + try: + # This needs the table name to be unescaped (no backticks). + rows = connection.execute(text('DESCRIBE {}'.format(full_table))).fetchall() + except exc.OperationalError as e: + # Does the table exist? + regex_fmt = r'TExecuteStatementResp.*SemanticException.*Table not found {}' + regex = regex_fmt.format(re.escape(full_table)) + if re.search(regex, e.args[0]): + raise exc.NoSuchTableError(full_table) + else: + raise + else: + # Hive is stupid: this is what I get from DESCRIBE some_schema.does_not_exist + regex = r'Table .* does not exist' + if len(rows) == 1 and re.match(regex, rows[0].col_name): + raise exc.NoSuchTableError(full_table) + return rows + + def has_table(self, connection, table_name, schema=None, **kw): + try: + self._get_table_columns(connection, table_name, schema) + return True + except exc.NoSuchTableError: + return False + + def get_columns(self, connection, table_name, schema=None, **kw): + rows = self._get_table_columns(connection, table_name, schema) + # Strip whitespace + rows = [[col.strip() if col else None for col in row] for row in rows] + # Filter out empty rows and comment + rows = [row for row in rows if row[0] and row[0] != '# col_name'] + result = [] + for (col_name, col_type, _comment) in rows: + if col_name == '# Partition Information': + break + # Take out the more detailed type information + # e.g. 'map' -> 'map' + # 'decimal(10,1)' -> decimal + col_type = re.search(r'^\w+', col_type).group(0) + try: + coltype = _type_map[col_type] + except KeyError: + util.warn("Did not recognize type '%s' of column '%s'" % (col_type, col_name)) + coltype = types.NullType + + result.append({ + 'name': col_name, + 'type': coltype, + 'nullable': True, + 'default': None, + }) + return result + + def get_foreign_keys(self, connection, table_name, schema=None, **kw): + # Hive has no support for foreign keys. + return [] + + def get_pk_constraint(self, connection, table_name, schema=None, **kw): + # Hive has no support for primary keys. + return [] + + def get_indexes(self, connection, table_name, schema=None, **kw): + rows = self._get_table_columns(connection, table_name, schema) + # Strip whitespace + rows = [[col.strip() if col else None for col in row] for row in rows] + # Filter out empty rows and comment + rows = [row for row in rows if row[0] and row[0] != '# col_name'] + for i, (col_name, _col_type, _comment) in enumerate(rows): + if col_name == '# Partition Information': + break + # Handle partition columns + col_names = [] + for col_name, _col_type, _comment in rows[i + 1:]: + col_names.append(col_name) + if col_names: + return [{'name': 'partition', 'column_names': col_names, 'unique': False}] + else: + return [] + + def get_table_names(self, connection, schema=None, **kw): + query = 'SHOW TABLES' + if schema: + query += ' IN ' + self.identifier_preparer.quote_identifier(schema) + + table_names = [] + + for row in connection.execute(text(query)): + # Hive returns 1 columns + if len(row) == 1: + table_names.append(row[0]) + # Spark SQL returns 3 columns + elif len(row) == 3: + table_names.append(row[1]) + else: + _logger.warning("Unexpected number of columns in SHOW TABLES result: {}".format(len(row))) + table_names.append('UNKNOWN') + + return table_names + + def do_rollback(self, dbapi_connection): + # No transactions for Hive + pass + + def _check_unicode_returns(self, connection, additional_tests=None): + # We decode everything as UTF-8 + return True + + def _check_unicode_description(self, connection): + # We decode everything as UTF-8 + return True + + +class HiveHTTPDialect(HiveDialect): + + name = "hive" + scheme = "http" + driver = "rest" + + def create_connect_args(self, url): + kwargs = { + "host": url.host, + "port": url.port or 10000, + "scheme": self.scheme, + "username": url.username or None, + "password": url.password or None, + "database": url.database or "default", + } + if url.query: + kwargs.update(url.query) + return [], kwargs + return ([], kwargs) + + +class HiveHTTPSDialect(HiveHTTPDialect): + + name = "hive" + scheme = "https" diff --git a/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_presto.py b/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_presto.py new file mode 100644 index 0000000..f5a256f --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_presto.py @@ -0,0 +1,256 @@ +"""Integration between SQLAlchemy and Presto. + +Some code based on +https://github.com/zzzeek/sqlalchemy/blob/rel_0_5/lib/sqlalchemy/databases/sqlite.py +which is released under the MIT license. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals + +import re +import sqlalchemy +from sqlalchemy import exc +from sqlalchemy import types +from sqlalchemy import util +# TODO shouldn't use mysql type +from sqlalchemy.sql import text +try: + from sqlalchemy.databases import mysql + mysql_tinyinteger = mysql.MSTinyInteger +except ImportError: + # Required for SQLAlchemy>=2.0 + from sqlalchemy.dialects import mysql + mysql_tinyinteger = mysql.base.MSTinyInteger +from sqlalchemy.engine import default +from sqlalchemy.sql import compiler, bindparam +from sqlalchemy.sql.compiler import SQLCompiler + +from pyhive import presto +from pyhive.common import UniversalSet + +sqlalchemy_version = float(re.search(r"^([\d]+\.[\d]+)\..+", sqlalchemy.__version__).group(1)) + +class PrestoIdentifierPreparer(compiler.IdentifierPreparer): + # Just quote everything to make things simpler / easier to upgrade + reserved_words = UniversalSet() + + +_type_map = { + 'boolean': types.Boolean, + 'tinyint': mysql_tinyinteger, + 'smallint': types.SmallInteger, + 'integer': types.Integer, + 'bigint': types.BigInteger, + 'real': types.Float, + 'double': types.Float, + 'varchar': types.String, + 'timestamp': types.TIMESTAMP, + 'date': types.DATE, + 'varbinary': types.VARBINARY, +} + + +class PrestoCompiler(SQLCompiler): + def visit_char_length_func(self, fn, **kw): + return 'length{}'.format(self.function_argspec(fn, **kw)) + + +class PrestoTypeCompiler(compiler.GenericTypeCompiler): + def visit_CLOB(self, type_, **kw): + raise ValueError("Presto does not support the CLOB column type.") + + def visit_NCLOB(self, type_, **kw): + raise ValueError("Presto does not support the NCLOB column type.") + + def visit_DATETIME(self, type_, **kw): + raise ValueError("Presto does not support the DATETIME column type.") + + def visit_FLOAT(self, type_, **kw): + return 'DOUBLE' + + def visit_TEXT(self, type_, **kw): + if type_.length: + return 'VARCHAR({:d})'.format(type_.length) + else: + return 'VARCHAR' + + +class PrestoDialect(default.DefaultDialect): + name = 'presto' + driver = 'rest' + paramstyle = 'pyformat' + preparer = PrestoIdentifierPreparer + statement_compiler = PrestoCompiler + supports_alter = False + supports_pk_autoincrement = False + supports_default_values = False + supports_empty_insert = False + supports_multivalues_insert = True + supports_unicode_statements = True + supports_unicode_binds = True + supports_statement_cache = False + returns_unicode_strings = True + description_encoding = None + supports_native_boolean = True + type_compiler = PrestoTypeCompiler + + @classmethod + def dbapi(cls): + return presto + + @classmethod + def import_dbapi(cls): + return presto + + def create_connect_args(self, url): + db_parts = (url.database or 'hive').split('/') + kwargs = { + 'host': url.host, + 'port': url.port or 8080, + 'username': url.username, + 'password': url.password + } + kwargs.update(url.query) + if len(db_parts) == 1: + kwargs['catalog'] = db_parts[0] + elif len(db_parts) == 2: + kwargs['catalog'] = db_parts[0] + kwargs['schema'] = db_parts[1] + else: + raise ValueError("Unexpected database format {}".format(url.database)) + return [], kwargs + + def get_schema_names(self, connection, **kw): + return [row.Schema for row in connection.execute(text('SHOW SCHEMAS'))] + + def _get_table_columns(self, connection, table_name, schema): + full_table = self.identifier_preparer.quote_identifier(table_name) + if schema: + full_table = self.identifier_preparer.quote_identifier(schema) + '.' + full_table + try: + return connection.execute(text('SHOW COLUMNS FROM {}'.format(full_table))) + except (presto.DatabaseError, exc.DatabaseError) as e: + # Normally SQLAlchemy should wrap this exception in sqlalchemy.exc.DatabaseError, which + # it successfully does in the Hive version. The difference with Presto is that this + # error is raised when fetching the cursor's description rather than the initial execute + # call. SQLAlchemy doesn't handle this. Thus, we catch the unwrapped + # presto.DatabaseError here. + # Does the table exist? + msg = ( + e.args[0].get('message') if e.args and isinstance(e.args[0], dict) + else e.args[0] if e.args and isinstance(e.args[0], str) + else None + ) + regex = r"Table\ \'.*{}\'\ does\ not\ exist".format(re.escape(table_name)) + if msg and re.search(regex, msg, re.IGNORECASE): + raise exc.NoSuchTableError(table_name) + else: + raise + + def has_table(self, connection, table_name, schema=None, **kw): + try: + self._get_table_columns(connection, table_name, schema) + return True + except exc.NoSuchTableError: + return False + + def get_columns(self, connection, table_name, schema=None, **kw): + rows = self._get_table_columns(connection, table_name, schema) + result = [] + for row in rows: + try: + coltype = _type_map[row.Type] + except KeyError: + util.warn("Did not recognize type '%s' of column '%s'" % (row.Type, row.Column)) + coltype = types.NullType + result.append({ + 'name': row.Column, + 'type': coltype, + # newer Presto no longer includes this column + 'nullable': getattr(row, 'Null', True), + 'default': None, + }) + return result + + def get_foreign_keys(self, connection, table_name, schema=None, **kw): + # Hive has no support for foreign keys. + return [] + + def get_pk_constraint(self, connection, table_name, schema=None, **kw): + # Hive has no support for primary keys. + return [] + + def get_indexes(self, connection, table_name, schema=None, **kw): + rows = self._get_table_columns(connection, table_name, schema) + col_names = [] + for row in rows: + part_key = 'Partition Key' + # Presto puts this information in one of 3 places depending on version + # - a boolean column named "Partition Key" + # - a string in the "Comment" column + # - a string in the "Extra" column + if sqlalchemy_version >= 1.4: + row = row._mapping + is_partition_key = ( + (part_key in row and row[part_key]) + or row['Comment'].startswith(part_key) + or ('Extra' in row and 'partition key' in row['Extra']) + ) + if is_partition_key: + col_names.append(row['Column']) + if col_names: + return [{'name': 'partition', 'column_names': col_names, 'unique': False}] + else: + return [] + + def _get_default_schema_name(self, connection): + #'SELECT CURRENT_SCHEMA()' + return super()._get_default_schema_name(connection) + + def get_table_names(self, connection, schema=None, **kw): + query = 'SHOW TABLES' + # N.B. This is incorrect, if no schema is provided, the current/default schema should be used + # with a call to an overridden self._get_default_schema_name(connection), but I could not + # see how to implement that as there is no CURRENT_SCHEMA function + # default_schema = self._get_default_schema_name(connection) + + if schema: + query += ' FROM ' + self.identifier_preparer.quote_identifier(schema) + return [row.Table for row in connection.execute(text(query))] + + def get_view_names(self, connection, schema=None, **kw): + if schema: + view_name_query = """ + SELECT table_name + FROM information_schema.views + WHERE table_schema = :schema + """ + query = text(view_name_query).bindparams( + bindparam("schema", type_=types.Unicode) + ) + else: + # N.B. This is incorrect, if no schema is provided, the current/default schema should + # be used with a call to self._get_default_schema_name(connection), but I could not + # see how to implement that + # default_schema = self._get_default_schema_name(connection) + view_name_query = """ + SELECT table_name + FROM information_schema.views + """ + query = text(view_name_query) + + result = connection.execute(query, dict(schema=schema)) + return [row[0] for row in result] + + def do_rollback(self, dbapi_connection): + # No transactions for Presto + pass + + def _check_unicode_returns(self, connection, additional_tests=None): + # requests gives back Unicode strings + return True + + def _check_unicode_description(self, connection): + # requests gives back Unicode strings + return True diff --git a/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_trino.py b/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_trino.py new file mode 100644 index 0000000..11be2a6 --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/sqlalchemy_trino.py @@ -0,0 +1,84 @@ +"""Integration between SQLAlchemy and Trino. + +Some code based on +https://github.com/zzzeek/sqlalchemy/blob/rel_0_5/lib/sqlalchemy/databases/sqlite.py +which is released under the MIT license. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals + +import re +from sqlalchemy import exc +from sqlalchemy import types +from sqlalchemy import util +# TODO shouldn't use mysql type +try: + from sqlalchemy.databases import mysql + mysql_tinyinteger = mysql.MSTinyInteger +except ImportError: + # Required for SQLAlchemy>=2.0 + from sqlalchemy.dialects import mysql + mysql_tinyinteger = mysql.base.MSTinyInteger +from sqlalchemy.engine import default +from sqlalchemy.sql import compiler +from sqlalchemy.sql.compiler import SQLCompiler + +from pyhive import trino +from pyhive.common import UniversalSet +from pyhive.sqlalchemy_presto import PrestoDialect, PrestoCompiler, PrestoIdentifierPreparer + +class TrinoIdentifierPreparer(PrestoIdentifierPreparer): + pass + + +_type_map = { + 'boolean': types.Boolean, + 'tinyint': mysql_tinyinteger, + 'smallint': types.SmallInteger, + 'integer': types.Integer, + 'bigint': types.BigInteger, + 'real': types.Float, + 'double': types.Float, + 'varchar': types.String, + 'timestamp': types.TIMESTAMP, + 'date': types.DATE, + 'varbinary': types.VARBINARY, +} + + +class TrinoCompiler(PrestoCompiler): + pass + + +class TrinoTypeCompiler(PrestoCompiler): + def visit_CLOB(self, type_, **kw): + raise ValueError("Trino does not support the CLOB column type.") + + def visit_NCLOB(self, type_, **kw): + raise ValueError("Trino does not support the NCLOB column type.") + + def visit_DATETIME(self, type_, **kw): + raise ValueError("Trino does not support the DATETIME column type.") + + def visit_FLOAT(self, type_, **kw): + return 'DOUBLE' + + def visit_TEXT(self, type_, **kw): + if type_.length: + return 'VARCHAR({:d})'.format(type_.length) + else: + return 'VARCHAR' + + +class TrinoDialect(PrestoDialect): + name = 'trino' + supports_statement_cache = False + + @classmethod + def dbapi(cls): + return trino + + @classmethod + def import_dbapi(cls): + return trino diff --git a/src/chronify/_vendor/kyuubi/pyhive/trino.py b/src/chronify/_vendor/kyuubi/pyhive/trino.py new file mode 100644 index 0000000..658457a --- /dev/null +++ b/src/chronify/_vendor/kyuubi/pyhive/trino.py @@ -0,0 +1,144 @@ +"""DB-API implementation backed by Trino + +See http://www.python.org/dev/peps/pep-0249/ + +Many docstrings in this file are based on the PEP, which is in the public domain. +""" + +from __future__ import absolute_import +from __future__ import unicode_literals + +import logging + +import requests + +# Make all exceptions visible in this module per DB-API +from pyhive.common import DBAPITypeObject +from pyhive.exc import * # noqa +from pyhive.presto import Connection as PrestoConnection, Cursor as PrestoCursor, PrestoParamEscaper + +try: # Python 3 + import urllib.parse as urlparse +except ImportError: # Python 2 + import urlparse + +# PEP 249 module globals +apilevel = '2.0' +threadsafety = 2 # Threads may share the module and connections. +paramstyle = 'pyformat' # Python extended format codes, e.g. ...WHERE name=%(name)s + +_logger = logging.getLogger(__name__) + + +class TrinoParamEscaper(PrestoParamEscaper): + pass + + +_escaper = TrinoParamEscaper() + + +def connect(*args, **kwargs): + """Constructor for creating a connection to the database. See class :py:class:`Connection` for + arguments. + + :returns: a :py:class:`Connection` object. + """ + return Connection(*args, **kwargs) + + +class Connection(PrestoConnection): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def cursor(self): + """Return a new :py:class:`Cursor` object using the connection.""" + return Cursor(*self._args, **self._kwargs) + + +class Cursor(PrestoCursor): + """These objects represent a database cursor, which is used to manage the context of a fetch + operation. + + Cursors are not isolated, i.e., any changes done to the database by a cursor are immediately + visible by other cursors or connections. + """ + + def execute(self, operation, parameters=None): + """Prepare and execute a database operation (query or command). + + Return values are not defined. + """ + headers = { + 'X-Trino-Catalog': self._catalog, + 'X-Trino-Schema': self._schema, + 'X-Trino-Source': self._source, + 'X-Trino-User': self._username, + } + + if self._session_props: + headers['X-Trino-Session'] = ','.join( + '{}={}'.format(propname, propval) + for propname, propval in self._session_props.items() + ) + + # Prepare statement + if parameters is None: + sql = operation + else: + sql = operation % _escaper.escape_args(parameters) + + self._reset_state() + + self._state = self._STATE_RUNNING + url = urlparse.urlunparse(( + self._protocol, + '{}:{}'.format(self._host, self._port), '/v1/statement', None, None, None)) + _logger.info('%s', sql) + _logger.debug("Headers: %s", headers) + response = self._requests_session.post( + url, data=sql.encode('utf-8'), headers=headers, **self._requests_kwargs) + self._process_response(response) + + def _process_response(self, response): + """Given the JSON response from Trino's REST API, update the internal state with the next + URI and any data from the response + """ + # TODO handle HTTP 503 + if response.status_code != requests.codes.ok: + fmt = "Unexpected status code {}\n{}" + raise OperationalError(fmt.format(response.status_code, response.content)) + + response_json = response.json() + _logger.debug("Got response %s", response_json) + assert self._state == self._STATE_RUNNING, "Should be running if processing response" + self._nextUri = response_json.get('nextUri') + self._columns = response_json.get('columns') + if 'id' in response_json: + self.last_query_id = response_json['id'] + if 'X-Trino-Clear-Session' in response.headers: + propname = response.headers['X-Trino-Clear-Session'] + self._session_props.pop(propname, None) + if 'X-Trino-Set-Session' in response.headers: + propname, propval = response.headers['X-Trino-Set-Session'].split('=', 1) + self._session_props[propname] = propval + if 'data' in response_json: + assert self._columns + new_data = response_json['data'] + self._process_data(new_data) + self._data += map(tuple, new_data) + if 'nextUri' not in response_json: + self._state = self._STATE_FINISHED + if 'error' in response_json: + raise DatabaseError(response_json['error']) + + +# +# Type Objects and Constructors +# + + +# See types in trino-main/src/main/java/com/facebook/trino/tuple/TupleInfo.java +FIXED_INT_64 = DBAPITypeObject(['bigint']) +VARIABLE_BINARY = DBAPITypeObject(['varchar']) +DOUBLE = DBAPITypeObject(['double']) +BOOLEAN = DBAPITypeObject(['boolean']) diff --git a/src/chronify/time_series_mapper_datetime.py b/src/chronify/time_series_mapper_datetime.py index 2d70551..108aaff 100644 --- a/src/chronify/time_series_mapper_datetime.py +++ b/src/chronify/time_series_mapper_datetime.py @@ -106,12 +106,17 @@ def _create_mapping(self) -> tuple[pd.DataFrame, MappingTableSchema]: # get standard time zone of to_tz to_tz_std = get_standard_time_zone(to_tz) # tz-naive time does not have skips/dups, so always localize in std tz first - ser_from = ser_from.dt.tz_localize(to_tz_std).dt.tz_convert(to_tz) + # mypy complains with error: "Properties" has no attribute "tz_localize" + # but the type is pandas.core.indexes.accessors.DatetimeProperties and the + # attribute exists. + ser_from = ser_from.dt.tz_localize(to_tz_std).dt.tz_convert(to_tz) # type: ignore + pass case (False, True): # get standard time zone of fm_tz fm_tz_std = get_standard_time_zone(fm_tz) # convert to standard time zone of fm_tz before making it tz-naive - ser_from = ser_from.dt.tz_convert(fm_tz_std).dt.tz_localize(to_tz) + ser_from = ser_from.dt.tz_convert(fm_tz_std).dt.tz_localize(to_tz) # type: ignore + pass match (self._adjust_interval, self._wrap_time_allowed): case (True, _): ser = pd.Series(