diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/Makefile b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/Makefile deleted file mode 100644 index 9f74ea80..00000000 --- a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -release: - sudo apt-get update - sudo apt-get -y install gcc libkrb5-dev - cd ./code && pip3 install -r requirements.txt -t . diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/INSTALLER b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/INSTALLER new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/LICENSE b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/LICENSE @@ -0,0 +1,202 @@ + + 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. diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/METADATA b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/METADATA new file mode 100644 index 00000000..4a43f45e --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/METADATA @@ -0,0 +1,129 @@ +Metadata-Version: 2.1 +Name: phoenixdb +Version: 0.7 +Summary: Phoenix database adapter for Python +Home-page: https://bitbucket.org/lalinsky/python-phoenixdb +Author: Lukas Lalinsky +Author-email: lukas@oxygene.sk +License: Apache 2 +Platform: UNKNOWN +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +License-File: LICENSE +Requires-Dist: protobuf (>=3.0.0) + +Phoenix database adapter for Python +=================================== + +``phoenixdb`` is a Python library for accessing the +`Phoenix SQL database `_ +using the +`remote query server `_. +The library implements the +standard `DB API 2.0 `_ interface, +which should be familiar to most Python programmers. + +Installation +------------ + +The easiest way to install the library is using `pip `_:: + + pip install phoenixdb + +You can also download the source code from `Bitbucket `_, +extract the archive and then install it manually:: + + cd /path/to/python-phoenix-x.y.z/ + python setup.py install + +Usage +----- + +The library implements the standard DB API 2.0 interface, so it can be +used the same way you would use any other SQL database from Python, for example:: + + import phoenixdb + import phoenixdb.cursor + + database_url = 'http://localhost:8765/' + conn = phoenixdb.connect(database_url, autocommit=True) + + cursor = conn.cursor() + cursor.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, username VARCHAR)") + cursor.execute("UPSERT INTO users VALUES (?, ?)", (1, 'admin')) + cursor.execute("SELECT * FROM users") + print cursor.fetchall() + + cursor = conn.cursor(cursor_factory=phoenixdb.cursor.DictCursor) + cursor.execute("SELECT * FROM users WHERE id=1") + print cursor.fetchone()['USERNAME'] + + +Setting up a development environment +------------------------------------ + +If you want to quickly try out the included examples, you can set up a +local `virtualenv `_ with all the +necessary requirements:: + + virtualenv e + source e/bin/activate + pip install -r requirements.txt + python setup.py develop + +To create or update protobuf classes, change the tag in ``gen-protobuf.sh`` and execute. + +If you need a Phoenix server for experimenting, you can get one running +quickly using Docker:: + + docker pull docker.oxygene.sk/lukas/python-phoenixdb/phoenix:4.11 + docker run -p 127.0.0.1:8765:8765 docker.oxygene.sk/lukas/python-phoenixdb/phoenix:4.11 + +Interactive SQL shell +--------------------- + +There is a Python-based interactive shell include in the examples folder, which can be +used to connect to Phoenix and execute queries:: + + ./examples/shell.py http://localhost:8765/ + db=> CREATE TABLE test (id INTEGER PRIMARY KEY, name VARCHAR); + no rows affected (1.363 seconds) + db=> UPSERT INTO test (id, name) VALUES (1, 'Lukas'); + 1 row affected (0.004 seconds) + db=> SELECT * FROM test; + +------+-------+ + | ID | NAME | + +======+=======+ + | 1 | Lukas | + +------+-------+ + 1 row selected (0.019 seconds) + +Running the test suite +---------------------- + +The library comes with a test suite for testing Python DB API 2.0 compliance and +various Phoenix-specific features. In order to run the test suite, you need a +working Phoenix database and set the ``PHOENIXDB_TEST_DB_URL`` environment variable:: + + export PHOENIXDB_TEST_DB_URL='http://localhost:8765/' + nosetests + +Known issues +------------ + +- In general, the library has not been battle-tested yet. You might encounter almost any problem. Use with care. +- You can only use the library in autocommit mode. The native Java Phoenix library also implements batched upserts, which can be committed at once, but this is not exposed over the remote server. + (`CALCITE-767 `_) +- TIME and DATE columns in Phoenix are stored as full timestamps with a millisecond accuracy, + but the remote protocol only exposes the time (hour/minute/second) or date (year/month/day) + parts of the columns. (`CALCITE-797 `_, `CALCITE-798 `_) +- TIMESTAMP columns in Phoenix are stored with a nanosecond accuracy, but the remote protocol truncates them to milliseconds. (`CALCITE-796 `_) +- ARRAY columns are not supported. + (`CALCITE-1050 `_, `PHOENIX-2585 `_) + + diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/RECORD b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/RECORD new file mode 100644 index 00000000..8957df4f --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/RECORD @@ -0,0 +1,43 @@ +phoenixdb-0.7.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +phoenixdb-0.7.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 +phoenixdb-0.7.dist-info/METADATA,sha256=XmSEvhH8c36F8E7RNXGSluytLN7bM8HlTnt2e03R0W4,4964 +phoenixdb-0.7.dist-info/RECORD,, +phoenixdb-0.7.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +phoenixdb-0.7.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 +phoenixdb-0.7.dist-info/top_level.txt,sha256=MRGfBgiXeMspRk2B1bNbkIEGT_ycsZU1YDp33l216Bw,10 +phoenixdb/__init__.py,sha256=f8bBWkBbcXGZkxsS0CImYQgDpJEe0pnhLi3vAIemwoA,2029 +phoenixdb/__pycache__/__init__.cpython-36.pyc,, +phoenixdb/__pycache__/avatica.cpython-36.pyc,, +phoenixdb/__pycache__/connection.cpython-36.pyc,, +phoenixdb/__pycache__/cursor.cpython-36.pyc,, +phoenixdb/__pycache__/errors.cpython-36.pyc,, +phoenixdb/__pycache__/types.cpython-36.pyc,, +phoenixdb/avatica.py,sha256=NKSJNZpHmCu2NmlPABbz9Lot_IY1MLxiIznZCl86cKY,18630 +phoenixdb/calcite/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +phoenixdb/calcite/__pycache__/__init__.cpython-36.pyc,, +phoenixdb/calcite/__pycache__/common_pb2.cpython-36.pyc,, +phoenixdb/calcite/__pycache__/requests_pb2.cpython-36.pyc,, +phoenixdb/calcite/__pycache__/responses_pb2.cpython-36.pyc,, +phoenixdb/calcite/common_pb2.py,sha256=4IBjJ_r4Um4XhuoDnw3860HnPFfaAiM3LCzxAT9oNU8,62373 +phoenixdb/calcite/requests_pb2.py,sha256=2HojROubIeV137wb-OTnneIVLXxDvvDA18hWtuJx1VI,43788 +phoenixdb/calcite/responses_pb2.py,sha256=S7nHgAjVTbBY7u8dkLpKUnA3HVdzuoiGW1-dIfbg6jk,34155 +phoenixdb/connection.py,sha256=oa6wFIKjh21LFrczvvVmZdHEk0W6g-zX9GZSDavpHLM,6536 +phoenixdb/cursor.py,sha256=5CnVXRjuLxAHHT_optEolmm484Ed-yDkcT4WUEJjJVU,11648 +phoenixdb/errors.py,sha256=B2EDQfqwi0TQ2SSyZrQEqBJRCmCUg73PehLWa0YK53Q,2852 +phoenixdb/tests/__init__.py,sha256=2fsmaMvxsL77Mw3HopliZ9RV4vTHyn0C7PKJJ8qCKLI,960 +phoenixdb/tests/__pycache__/__init__.cpython-36.pyc,, +phoenixdb/tests/__pycache__/dbapi20.cpython-36.pyc,, +phoenixdb/tests/__pycache__/test_avatica.cpython-36.pyc,, +phoenixdb/tests/__pycache__/test_connection.cpython-36.pyc,, +phoenixdb/tests/__pycache__/test_db.cpython-36.pyc,, +phoenixdb/tests/__pycache__/test_dbapi20.cpython-36.pyc,, +phoenixdb/tests/__pycache__/test_errors.cpython-36.pyc,, +phoenixdb/tests/__pycache__/test_types.cpython-36.pyc,, +phoenixdb/tests/dbapi20.py,sha256=cSQ7Arxz6d5WHJInYSP56mK0dvGdHkkHHJfnJfkbw3o,31611 +phoenixdb/tests/test_avatica.py,sha256=QdZ8EQYyGaLs2zsbxIzSwrVAyzsSwnoZGm7cKlWZr4U,438 +phoenixdb/tests/test_connection.py,sha256=bGXLEcoQg4Y9LKoe7ERzLSL9AJVUrVk_m72-CcXTDPY,1052 +phoenixdb/tests/test_db.py,sha256=LBqpyd5_6BkAqY83QIV8k815AtsmbLtqIOTNTOzRNHE,2795 +phoenixdb/tests/test_dbapi20.py,sha256=nQJBJlYoBr_pL0sspR3r5lmf0U7pu_aS9dyWGk0BXFo,3966 +phoenixdb/tests/test_errors.py,sha256=ghgBxHz0PECpusUWcYrKUF4echa20ua-1v7B9jVzWlk,2121 +phoenixdb/tests/test_types.py,sha256=9eIsJEZV9_Q2YdEr9nzbw3i_deS24JwqTTq7H2ny6wE,17902 +phoenixdb/types.py,sha256=v87tsrKDoU6vR1vvwBe6nWogx7vzW9tQxhPh1Rz5iG8,6679 diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/REQUESTED b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/REQUESTED new file mode 100644 index 00000000..e69de29b diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/WHEEL b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/WHEEL new file mode 100644 index 00000000..becc9a66 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.1) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/top_level.txt b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/top_level.txt new file mode 100644 index 00000000..40625c63 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb-0.7.dist-info/top_level.txt @@ -0,0 +1 @@ +phoenixdb diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__init__.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__init__.py new file mode 100644 index 00000000..33f0e626 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__init__.py @@ -0,0 +1,67 @@ +# Copyright 2015 Lukas Lalinsky +# +# 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. + +from phoenixdb import errors, types +from phoenixdb.avatica import AvaticaClient +from phoenixdb.connection import Connection +from phoenixdb.errors import * +from phoenixdb.types import * + +__all__ = ['connect', 'apilevel', 'threadsafety', 'paramstyle'] + types.__all__ + errors.__all__ + + +apilevel = "2.0" +""" +This module supports the `DB API 2.0 interface `_. +""" + +threadsafety = 1 +""" +Multiple threads can share the module, but neither connections nor cursors. +""" + +paramstyle = 'qmark' +""" +Parmetrized queries should use the question mark as a parameter placeholder. + +For example:: + + cursor.execute("SELECT * FROM table WHERE id = ?", [my_id]) +""" + + +def connect(url, max_retries=None, **kwargs): + """Connects to a Phoenix query server. + + :param url: + URL to the Phoenix query server, e.g. ``http://localhost:8765/`` + + :param autocommit: + Switch the connection to autocommit mode. + + :param readonly: + Switch the connection to readonly mode. + + :param max_retries: + The maximum number of retries in case there is a connection error. + + :param cursor_factory: + If specified, the connection's :attr:`~phoenixdb.connection.Connection.cursor_factory` is set to it. + + :returns: + :class:`~phoenixdb.connection.Connection` object. + """ + client = AvaticaClient(url, max_retries=max_retries) + client.connect() + return Connection(client, **kwargs) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/__init__.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 00000000..952335b4 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/__init__.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/avatica.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/avatica.cpython-36.pyc new file mode 100644 index 00000000..ca941d2c Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/avatica.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/connection.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/connection.cpython-36.pyc new file mode 100644 index 00000000..61f20fda Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/connection.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/cursor.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/cursor.cpython-36.pyc new file mode 100644 index 00000000..887e57e3 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/cursor.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/errors.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/errors.cpython-36.pyc new file mode 100644 index 00000000..2f68ed32 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/errors.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/types.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/types.cpython-36.pyc new file mode 100644 index 00000000..c595ce50 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/__pycache__/types.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/avatica.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/avatica.py new file mode 100644 index 00000000..13d1bad9 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/avatica.py @@ -0,0 +1,508 @@ +# Copyright 2015 Lukas Lalinsky +# +# 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. + +"""Implementation of the JSON-over-HTTP RPC protocol used by Avatica.""" + +import re +import socket +import pprint +import math +import logging +import time +from phoenixdb import errors +from phoenixdb.calcite import requests_pb2, common_pb2, responses_pb2 + +try: + import httplib +except ImportError: + import http.client as httplib + +try: + import urlparse +except ImportError: + import urllib.parse as urlparse + +try: + from HTMLParser import HTMLParser +except ImportError: + from html.parser import HTMLParser + +__all__ = ['AvaticaClient'] + +logger = logging.getLogger(__name__) + + +class JettyErrorPageParser(HTMLParser): + + def __init__(self): + HTMLParser.__init__(self) + self.path = [] + self.title = [] + self.message = [] + + def handle_starttag(self, tag, attrs): + self.path.append(tag) + + def handle_endtag(self, tag): + self.path.pop() + + def handle_data(self, data): + if len(self.path) > 2 and self.path[0] == 'html' and self.path[1] == 'body': + if len(self.path) == 3 and self.path[2] == 'h2': + self.title.append(data.strip()) + elif len(self.path) == 4 and self.path[2] == 'p' and self.path[3] == 'pre': + self.message.append(data.strip()) + + +def parse_url(url): + url = urlparse.urlparse(url) + if not url.scheme and not url.netloc and url.path: + netloc = url.path + if ':' not in netloc: + netloc = '{}:8765'.format(netloc) + return urlparse.ParseResult('http', netloc, '/', '', '', '') + return url + + +# Defined in phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java +SQLSTATE_ERROR_CLASSES = [ + ('08', errors.OperationalError), # Connection Exception + ('22018', errors.IntegrityError), # Constraint violatioin. + ('22', errors.DataError), # Data Exception + ('23', errors.IntegrityError), # Constraint Violation + ('24', errors.InternalError), # Invalid Cursor State + ('25', errors.InternalError), # Invalid Transaction State + ('42', errors.ProgrammingError), # Syntax Error or Access Rule Violation + ('XLC', errors.OperationalError), # Execution exceptions + ('INT', errors.InternalError), # Phoenix internal error +] + +# Relevant properties as defined by https://calcite.apache.org/avatica/docs/client_reference.html +OPEN_CONNECTION_PROPERTIES = ( + 'user', # User for the database connection + 'password', # Password for the user +) + + +def raise_sql_error(code, sqlstate, message): + for prefix, error_class in SQLSTATE_ERROR_CLASSES: + if sqlstate.startswith(prefix): + raise error_class(message, code, sqlstate) + + +def parse_and_raise_sql_error(message): + match = re.findall(r'(?:([^ ]+): )?ERROR (\d+) \(([0-9A-Z]{5})\): (.*?) ->', message) + if match is not None and len(match): + exception, code, sqlstate, message = match[0] + raise_sql_error(int(code), sqlstate, message) + + +def parse_error_page(html): + parser = JettyErrorPageParser() + parser.feed(html) + if parser.title == ['HTTP ERROR: 500']: + message = ' '.join(parser.message).strip() + parse_and_raise_sql_error(message) + raise errors.InternalError(message) + + +def parse_error_protobuf(text): + message = common_pb2.WireMessage() + message.ParseFromString(text) + + err = responses_pb2.ErrorResponse() + err.ParseFromString(message.wrapped_message) + + parse_and_raise_sql_error(err.error_message) + raise_sql_error(err.error_code, err.sql_state, err.error_message) + raise errors.InternalError(err.error_message) + + +class AvaticaClient(object): + """Client for Avatica's RPC server. + + This exposes all low-level functionality that the Avatica + server provides, using the native terminology. You most likely + do not want to use this class directly, but rather get connect + to a server using :func:`phoenixdb.connect`. + """ + + def __init__(self, url, max_retries=None): + """Constructs a new client object. + + :param url: + URL of an Avatica RPC server. + """ + self.url = parse_url(url) + self.max_retries = max_retries if max_retries is not None else 3 + self.connection = None + + def connect(self): + """Opens a HTTP connection to the RPC server.""" + logger.debug("Opening connection to %s:%s", self.url.hostname, self.url.port) + try: + self.connection = httplib.HTTPConnection(self.url.hostname, self.url.port) + self.connection.connect() + except (httplib.HTTPException, socket.error) as e: + raise errors.InterfaceError('Unable to connect to the specified service', e) + + def close(self): + """Closes the HTTP connection to the RPC server.""" + if self.connection is not None: + logger.debug("Closing connection to %s:%s", self.url.hostname, self.url.port) + try: + self.connection.close() + except httplib.HTTPException as e: + logger.warning("Error while closing connection", exc_info=True) + self.connection = None + + def _post_request(self, body, headers): + retry_count = self.max_retries + while True: + logger.debug("POST %s %r %r", self.url.path, body, headers) + try: + self.connection.request('POST', self.url.path, body=body, headers=headers) + response = self.connection.getresponse() + except httplib.HTTPException as e: + if retry_count > 0: + delay = math.exp(-retry_count) + logger.debug("HTTP protocol error, will retry in %s seconds...", delay, exc_info=True) + self.close() + self.connect() + time.sleep(delay) + retry_count -= 1 + continue + raise errors.InterfaceError('RPC request failed', cause=e) + else: + if response.status == httplib.SERVICE_UNAVAILABLE: + if retry_count > 0: + delay = math.exp(-retry_count) + logger.debug("Service unavailable, will retry in %s seconds...", delay, exc_info=True) + time.sleep(delay) + retry_count -= 1 + continue + return response + + def _apply(self, request_data, expected_response_type=None): + logger.debug("Sending request\n%s", pprint.pformat(request_data)) + + request_name = request_data.__class__.__name__ + message = common_pb2.WireMessage() + message.name = 'org.apache.calcite.avatica.proto.Requests${}'.format(request_name) + message.wrapped_message = request_data.SerializeToString() + body = message.SerializeToString() + headers = {'content-type': 'application/x-google-protobuf'} + + response = self._post_request(body, headers) + response_body = response.read() + + if response.status != httplib.OK: + logger.debug("Received response\n%s", response_body) + if b'' in response_body: + parse_error_page(response_body) + else: + # assume the response is in protobuf format + parse_error_protobuf(response_body) + raise errors.InterfaceError('RPC request returned invalid status code', response.status) + + message = common_pb2.WireMessage() + message.ParseFromString(response_body) + + logger.debug("Received response\n%s", message) + + if expected_response_type is None: + expected_response_type = request_name.replace('Request', 'Response') + + expected_response_type = 'org.apache.calcite.avatica.proto.Responses$' + expected_response_type + if message.name != expected_response_type: + raise errors.InterfaceError('unexpected response type "{}"'.format(message.name)) + + return message.wrapped_message + + def get_catalogs(self, connection_id): + request = requests_pb2.CatalogsRequest() + request.connection_id = connection_id + return self._apply(request) + + def get_schemas(self, connection_id, catalog=None, schemaPattern=None): + request = requests_pb2.SchemasRequest() + request.connection_id = connection_id + if catalog is not None: + request.catalog = catalog + if schemaPattern is not None: + request.schema_pattern = schemaPattern + return self._apply(request) + + def get_tables(self, connection_id, catalog=None, schemaPattern=None, tableNamePattern=None, typeList=None): + request = requests_pb2.TablesRequest() + request.connection_id = connection_id + if catalog is not None: + request.catalog = catalog + if schemaPattern is not None: + request.schema_pattern = schemaPattern + if tableNamePattern is not None: + request.table_name_pattern = tableNamePattern + if typeList is not None: + request.type_list = typeList + if typeList is not None: + request.type_list.extend(typeList) + request.has_type_list = typeList is not None + return self._apply(request) + + def get_columns(self, connection_id, catalog=None, schemaPattern=None, tableNamePattern=None, columnNamePattern=None): + request = requests_pb2.ColumnsRequest() + request.connection_id = connection_id + if catalog is not None: + request.catalog = catalog + if schemaPattern is not None: + request.schema_pattern = schemaPattern + if tableNamePattern is not None: + request.table_name_pattern = tableNamePattern + if columnNamePattern is not None: + request.column_name_pattern = columnNamePattern + return self._apply(request) + + def get_table_types(self, connection_id): + request = requests_pb2.TableTypesRequest() + request.connection_id = connection_id + return self._apply(request) + + def get_type_info(self, connection_id): + request = requests_pb2.TypeInfoRequest() + request.connection_id = connection_id + return self._apply(request) + + def connection_sync(self, connection_id, connProps=None): + """Synchronizes connection properties with the server. + + :param connection_id: + ID of the current connection. + + :param connProps: + Dictionary with the properties that should be changed. + + :returns: + A ``common_pb2.ConnectionProperties`` object. + """ + if connProps is None: + connProps = {} + + request = requests_pb2.ConnectionSyncRequest() + request.connection_id = connection_id + request.conn_props.auto_commit = connProps.get('autoCommit', False) + request.conn_props.has_auto_commit = True + request.conn_props.read_only = connProps.get('readOnly', False) + request.conn_props.has_read_only = True + request.conn_props.transaction_isolation = connProps.get('transactionIsolation', 0) + request.conn_props.catalog = connProps.get('catalog', '') + request.conn_props.schema = connProps.get('schema', '') + + response_data = self._apply(request) + response = responses_pb2.ConnectionSyncResponse() + response.ParseFromString(response_data) + return response.conn_props + + def open_connection(self, connection_id, info=None): + """Opens a new connection. + + :param connection_id: + ID of the connection to open. + """ + request = requests_pb2.OpenConnectionRequest() + request.connection_id = connection_id + if info is not None: + # Info is a list of repeated pairs, setting a dict directly fails + for k, v in info.items(): + request.info[k] = v + + response_data = self._apply(request) + response = responses_pb2.OpenConnectionResponse() + response.ParseFromString(response_data) + + def close_connection(self, connection_id): + """Closes a connection. + + :param connection_id: + ID of the connection to close. + """ + request = requests_pb2.CloseConnectionRequest() + request.connection_id = connection_id + self._apply(request) + + def create_statement(self, connection_id): + """Creates a new statement. + + :param connection_id: + ID of the current connection. + + :returns: + New statement ID. + """ + request = requests_pb2.CreateStatementRequest() + request.connection_id = connection_id + + response_data = self._apply(request) + response = responses_pb2.CreateStatementResponse() + response.ParseFromString(response_data) + return response.statement_id + + def close_statement(self, connection_id, statement_id): + """Closes a statement. + + :param connection_id: + ID of the current connection. + + :param statement_id: + ID of the statement to close. + """ + request = requests_pb2.CloseStatementRequest() + request.connection_id = connection_id + request.statement_id = statement_id + + self._apply(request) + + def prepare_and_execute(self, connection_id, statement_id, sql, max_rows_total=None, first_frame_max_size=None): + """Prepares and immediately executes a statement. + + :param connection_id: + ID of the current connection. + + :param statement_id: + ID of the statement to prepare. + + :param sql: + SQL query. + + :param max_rows_total: + The maximum number of rows that will be allowed for this query. + + :param first_frame_max_size: + The maximum number of rows that will be returned in the first Frame returned for this query. + + :returns: + Result set with the signature of the prepared statement and the first frame data. + """ + request = requests_pb2.PrepareAndExecuteRequest() + request.connection_id = connection_id + request.statement_id = statement_id + request.sql = sql + if max_rows_total is not None: + request.max_rows_total = max_rows_total + if first_frame_max_size is not None: + request.first_frame_max_size = first_frame_max_size + + response_data = self._apply(request, 'ExecuteResponse') + response = responses_pb2.ExecuteResponse() + response.ParseFromString(response_data) + return response.results + + def prepare(self, connection_id, sql, max_rows_total=None): + """Prepares a statement. + + :param connection_id: + ID of the current connection. + + :param sql: + SQL query. + + :param max_rows_total: + The maximum number of rows that will be allowed for this query. + + :returns: + Signature of the prepared statement. + """ + request = requests_pb2.PrepareRequest() + request.connection_id = connection_id + request.sql = sql + if max_rows_total is not None: + request.max_rows_total = max_rows_total + + response_data = self._apply(request) + response = responses_pb2.PrepareResponse() + response.ParseFromString(response_data) + return response.statement + + def execute(self, connection_id, statement_id, signature, parameter_values=None, first_frame_max_size=None): + """Returns a frame of rows. + + The frame describes whether there may be another frame. If there is not + another frame, the current iteration is done when we have finished the + rows in the this frame. + + :param connection_id: + ID of the current connection. + + :param statement_id: + ID of the statement to fetch rows from. + + :param signature: + common_pb2.Signature object + + :param parameter_values: + A list of parameter values, if statement is to be executed; otherwise ``None``. + + :param first_frame_max_size: + The maximum number of rows that will be returned in the first Frame returned for this query. + + :returns: + Frame data, or ``None`` if there are no more. + """ + request = requests_pb2.ExecuteRequest() + request.statementHandle.id = statement_id + request.statementHandle.connection_id = connection_id + request.statementHandle.signature.CopyFrom(signature) + if parameter_values is not None: + request.parameter_values.extend(parameter_values) + request.has_parameter_values = True + if first_frame_max_size is not None: + request.first_frame_max_size = first_frame_max_size + + response_data = self._apply(request) + response = responses_pb2.ExecuteResponse() + response.ParseFromString(response_data) + return response.results + + def fetch(self, connection_id, statement_id, offset=0, frame_max_size=None): + """Returns a frame of rows. + + The frame describes whether there may be another frame. If there is not + another frame, the current iteration is done when we have finished the + rows in the this frame. + + :param connection_id: + ID of the current connection. + + :param statement_id: + ID of the statement to fetch rows from. + + :param offset: + Zero-based offset of first row in the requested frame. + + :param frame_max_size: + Maximum number of rows to return; negative means no limit. + + :returns: + Frame data, or ``None`` if there are no more. + """ + request = requests_pb2.FetchRequest() + request.connection_id = connection_id + request.statement_id = statement_id + request.offset = offset + if frame_max_size is not None: + request.frame_max_size = frame_max_size + + response_data = self._apply(request) + response = responses_pb2.FetchResponse() + response.ParseFromString(response_data) + return response.frame diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__init__.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__init__.py @@ -0,0 +1 @@ + diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/__init__.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 00000000..1e6069b3 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/__init__.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/common_pb2.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/common_pb2.cpython-36.pyc new file mode 100644 index 00000000..39c9e679 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/common_pb2.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/requests_pb2.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/requests_pb2.cpython-36.pyc new file mode 100644 index 00000000..63c1654f Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/requests_pb2.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/responses_pb2.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/responses_pb2.cpython-36.pyc new file mode 100644 index 00000000..586c3638 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/__pycache__/responses_pb2.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/common_pb2.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/common_pb2.py new file mode 100644 index 00000000..ef934366 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/common_pb2.py @@ -0,0 +1,1644 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='common.proto', + package='', + syntax='proto3', + serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 \x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 \x01(\x08\x12\x11\n\tread_only\x18\x03 \x01(\x08\x12\x15\n\rhas_read_only\x18\x08 \x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 \x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 \x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 \x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 \x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12%\n\nparameters\x18\x03 \x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 \x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 \x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 \x01(\x08\x12\x12\n\nsearchable\x18\x04 \x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 \x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 \x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t \x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n \x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c \x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e \x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f \x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 \x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 \x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 \x01(\t\x12\x1a\n\x04type\x18\x14 \x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 \x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 \x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18\x05 \x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 \x01(\r\x12\x16\n\x0eparameter_type\x18\x04 \x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 \x01(\t\x12\x0c\n\x04name\x18\x07 \x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 \x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 \x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 \x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 \x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 \x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(\t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 \x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 \x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 \x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 \x01(\x08\x12!\n\x0cscalar_value\x18\x04 \x01(\x0b\x32\x0b.TypedValue\"\x99\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 \x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 \x01(\x08\x12\x14\n\x0cstring_value\x18\x03 \x01(\t\x12\x14\n\x0cnumber_value\x18\x04 \x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 \x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 \x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\"\xa6\x02\n\x19MetaDataOperationArgument\x12\x14\n\x0cstring_value\x18\x01 \x01(\t\x12\x12\n\nbool_value\x18\x02 \x01(\x08\x12\x11\n\tint_value\x18\x03 \x01(\x11\x12\x1b\n\x13string_array_values\x18\x04 \x03(\t\x12\x18\n\x10int_array_values\x18\x05 \x03(\x11\x12\x35\n\x04type\x18\x06 \x01(\x0e\x32\'.MetaDataOperationArgument.ArgumentType\"^\n\x0c\x41rgumentType\x12\n\n\x06STRING\x10\x00\x12\x08\n\x04\x42OOL\x10\x01\x12\x07\n\x03INT\x10\x02\x12\x13\n\x0fREPEATED_STRING\x10\x03\x12\x10\n\x0cREPEATED_INT\x10\x04\x12\x08\n\x04NULL\x10\x05\"\xb0\x01\n\nQueryState\x12\x18\n\x04type\x18\x01 \x01(\x0e\x32\n.StateType\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x1e\n\x02op\x18\x03 \x01(\x0e\x32\x12.MetaDataOperation\x12(\n\x04\x61rgs\x18\x04 \x03(\x0b\x32\x1a.MetaDataOperationArgument\x12\x10\n\x08has_args\x18\x05 \x01(\x08\x12\x0f\n\x07has_sql\x18\x06 \x01(\x08\x12\x0e\n\x06has_op\x18\x07 \x01(\x08*\x9f\x01\n\rStatementType\x12\n\n\x06SELECT\x10\x00\x12\n\n\x06INSERT\x10\x01\x12\n\n\x06UPDATE\x10\x02\x12\n\n\x06\x44\x45LETE\x10\x03\x12\n\n\x06UPSERT\x10\x04\x12\t\n\x05MERGE\x10\x05\x12\r\n\tOTHER_DML\x10\x06\x12\n\n\x06\x43REATE\x10\x07\x12\x08\n\x04\x44ROP\x10\x08\x12\t\n\x05\x41LTER\x10\t\x12\r\n\tOTHER_DDL\x10\n\x12\x08\n\x04\x43\x41LL\x10\x0b*\xe2\x03\n\x03Rep\x12\x15\n\x11PRIMITIVE_BOOLEAN\x10\x00\x12\x12\n\x0ePRIMITIVE_BYTE\x10\x01\x12\x12\n\x0ePRIMITIVE_CHAR\x10\x02\x12\x13\n\x0fPRIMITIVE_SHORT\x10\x03\x12\x11\n\rPRIMITIVE_INT\x10\x04\x12\x12\n\x0ePRIMITIVE_LONG\x10\x05\x12\x13\n\x0fPRIMITIVE_FLOAT\x10\x06\x12\x14\n\x10PRIMITIVE_DOUBLE\x10\x07\x12\x0b\n\x07\x42OOLEAN\x10\x08\x12\x08\n\x04\x42YTE\x10\t\x12\r\n\tCHARACTER\x10\n\x12\t\n\x05SHORT\x10\x0b\x12\x0b\n\x07INTEGER\x10\x0c\x12\x08\n\x04LONG\x10\r\x12\t\n\x05\x46LOAT\x10\x0e\x12\n\n\x06\x44OUBLE\x10\x0f\x12\x0f\n\x0b\x42IG_INTEGER\x10\x19\x12\x0f\n\x0b\x42IG_DECIMAL\x10\x1a\x12\x11\n\rJAVA_SQL_TIME\x10\x10\x12\x16\n\x12JAVA_SQL_TIMESTAMP\x10\x11\x12\x11\n\rJAVA_SQL_DATE\x10\x12\x12\x12\n\x0eJAVA_UTIL_DATE\x10\x13\x12\x0f\n\x0b\x42YTE_STRING\x10\x14\x12\n\n\x06STRING\x10\x15\x12\n\n\x06NUMBER\x10\x16\x12\n\n\x06OBJECT\x10\x17\x12\x08\n\x04NULL\x10\x18\x12\t\n\x05\x41RRAY\x10\x1b\x12\n\n\x06STRUCT\x10\x1c\x12\x0c\n\x08MULTISET\x10\x1d*^\n\x08Severity\x12\x14\n\x10UNKNOWN_SEVERITY\x10\x00\x12\x12\n\x0e\x46\x41TAL_SEVERITY\x10\x01\x12\x12\n\x0e\x45RROR_SEVERITY\x10\x02\x12\x14\n\x10WARNING_SEVERITY\x10\x03*\xd7\x04\n\x11MetaDataOperation\x12\x12\n\x0eGET_ATTRIBUTES\x10\x00\x12\x1b\n\x17GET_BEST_ROW_IDENTIFIER\x10\x01\x12\x10\n\x0cGET_CATALOGS\x10\x02\x12\x1e\n\x1aGET_CLIENT_INFO_PROPERTIES\x10\x03\x12\x19\n\x15GET_COLUMN_PRIVILEGES\x10\x04\x12\x0f\n\x0bGET_COLUMNS\x10\x05\x12\x17\n\x13GET_CROSS_REFERENCE\x10\x06\x12\x15\n\x11GET_EXPORTED_KEYS\x10\x07\x12\x18\n\x14GET_FUNCTION_COLUMNS\x10\x08\x12\x11\n\rGET_FUNCTIONS\x10\t\x12\x15\n\x11GET_IMPORTED_KEYS\x10\n\x12\x12\n\x0eGET_INDEX_INFO\x10\x0b\x12\x14\n\x10GET_PRIMARY_KEYS\x10\x0c\x12\x19\n\x15GET_PROCEDURE_COLUMNS\x10\r\x12\x12\n\x0eGET_PROCEDURES\x10\x0e\x12\x16\n\x12GET_PSEUDO_COLUMNS\x10\x0f\x12\x0f\n\x0bGET_SCHEMAS\x10\x10\x12\x19\n\x15GET_SCHEMAS_WITH_ARGS\x10\x11\x12\x14\n\x10GET_SUPER_TABLES\x10\x12\x12\x13\n\x0fGET_SUPER_TYPES\x10\x13\x12\x18\n\x14GET_TABLE_PRIVILEGES\x10\x14\x12\x0e\n\nGET_TABLES\x10\x15\x12\x13\n\x0fGET_TABLE_TYPES\x10\x16\x12\x11\n\rGET_TYPE_INFO\x10\x17\x12\x0c\n\x08GET_UDTS\x10\x18\x12\x17\n\x13GET_VERSION_COLUMNS\x10\x19*\"\n\tStateType\x12\x07\n\x03SQL\x10\x00\x12\x0c\n\x08METADATA\x10\x01\x42\"\n org.apache.calcite.avatica.protob\x06proto3') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_STATEMENTTYPE = _descriptor.EnumDescriptor( + name='StatementType', + full_name='StatementType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='SELECT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INSERT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UPDATE', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DELETE', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UPSERT', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MERGE', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='OTHER_DML', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CREATE', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DROP', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ALTER', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='OTHER_DDL', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CALL', index=11, number=11, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2337, + serialized_end=2496, +) +_sym_db.RegisterEnumDescriptor(_STATEMENTTYPE) + +StatementType = enum_type_wrapper.EnumTypeWrapper(_STATEMENTTYPE) +_REP = _descriptor.EnumDescriptor( + name='Rep', + full_name='Rep', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_BOOLEAN', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_BYTE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_CHAR', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_SHORT', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_INT', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_LONG', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_FLOAT', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVE_DOUBLE', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BOOLEAN', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BYTE', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHARACTER', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SHORT', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INTEGER', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LONG', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DOUBLE', index=15, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BIG_INTEGER', index=16, number=25, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BIG_DECIMAL', index=17, number=26, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='JAVA_SQL_TIME', index=18, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='JAVA_SQL_TIMESTAMP', index=19, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='JAVA_SQL_DATE', index=20, number=18, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='JAVA_UTIL_DATE', index=21, number=19, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BYTE_STRING', index=22, number=20, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRING', index=23, number=21, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NUMBER', index=24, number=22, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='OBJECT', index=25, number=23, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NULL', index=26, number=24, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ARRAY', index=27, number=27, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRUCT', index=28, number=28, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MULTISET', index=29, number=29, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2499, + serialized_end=2981, +) +_sym_db.RegisterEnumDescriptor(_REP) + +Rep = enum_type_wrapper.EnumTypeWrapper(_REP) +_SEVERITY = _descriptor.EnumDescriptor( + name='Severity', + full_name='Severity', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNKNOWN_SEVERITY', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FATAL_SEVERITY', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ERROR_SEVERITY', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WARNING_SEVERITY', index=3, number=3, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2983, + serialized_end=3077, +) +_sym_db.RegisterEnumDescriptor(_SEVERITY) + +Severity = enum_type_wrapper.EnumTypeWrapper(_SEVERITY) +_METADATAOPERATION = _descriptor.EnumDescriptor( + name='MetaDataOperation', + full_name='MetaDataOperation', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='GET_ATTRIBUTES', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_BEST_ROW_IDENTIFIER', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_CATALOGS', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_CLIENT_INFO_PROPERTIES', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_COLUMN_PRIVILEGES', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_COLUMNS', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_CROSS_REFERENCE', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_EXPORTED_KEYS', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_FUNCTION_COLUMNS', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_FUNCTIONS', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_IMPORTED_KEYS', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_INDEX_INFO', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_PRIMARY_KEYS', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_PROCEDURE_COLUMNS', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_PROCEDURES', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_PSEUDO_COLUMNS', index=15, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_SCHEMAS', index=16, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_SCHEMAS_WITH_ARGS', index=17, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_SUPER_TABLES', index=18, number=18, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_SUPER_TYPES', index=19, number=19, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_TABLE_PRIVILEGES', index=20, number=20, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_TABLES', index=21, number=21, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_TABLE_TYPES', index=22, number=22, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_TYPE_INFO', index=23, number=23, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_UDTS', index=24, number=24, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_VERSION_COLUMNS', index=25, number=25, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3080, + serialized_end=3679, +) +_sym_db.RegisterEnumDescriptor(_METADATAOPERATION) + +MetaDataOperation = enum_type_wrapper.EnumTypeWrapper(_METADATAOPERATION) +_STATETYPE = _descriptor.EnumDescriptor( + name='StateType', + full_name='StateType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='SQL', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='METADATA', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3681, + serialized_end=3715, +) +_sym_db.RegisterEnumDescriptor(_STATETYPE) + +StateType = enum_type_wrapper.EnumTypeWrapper(_STATETYPE) +SELECT = 0 +INSERT = 1 +UPDATE = 2 +DELETE = 3 +UPSERT = 4 +MERGE = 5 +OTHER_DML = 6 +CREATE = 7 +DROP = 8 +ALTER = 9 +OTHER_DDL = 10 +CALL = 11 +PRIMITIVE_BOOLEAN = 0 +PRIMITIVE_BYTE = 1 +PRIMITIVE_CHAR = 2 +PRIMITIVE_SHORT = 3 +PRIMITIVE_INT = 4 +PRIMITIVE_LONG = 5 +PRIMITIVE_FLOAT = 6 +PRIMITIVE_DOUBLE = 7 +BOOLEAN = 8 +BYTE = 9 +CHARACTER = 10 +SHORT = 11 +INTEGER = 12 +LONG = 13 +FLOAT = 14 +DOUBLE = 15 +BIG_INTEGER = 25 +BIG_DECIMAL = 26 +JAVA_SQL_TIME = 16 +JAVA_SQL_TIMESTAMP = 17 +JAVA_SQL_DATE = 18 +JAVA_UTIL_DATE = 19 +BYTE_STRING = 20 +STRING = 21 +NUMBER = 22 +OBJECT = 23 +NULL = 24 +ARRAY = 27 +STRUCT = 28 +MULTISET = 29 +UNKNOWN_SEVERITY = 0 +FATAL_SEVERITY = 1 +ERROR_SEVERITY = 2 +WARNING_SEVERITY = 3 +GET_ATTRIBUTES = 0 +GET_BEST_ROW_IDENTIFIER = 1 +GET_CATALOGS = 2 +GET_CLIENT_INFO_PROPERTIES = 3 +GET_COLUMN_PRIVILEGES = 4 +GET_COLUMNS = 5 +GET_CROSS_REFERENCE = 6 +GET_EXPORTED_KEYS = 7 +GET_FUNCTION_COLUMNS = 8 +GET_FUNCTIONS = 9 +GET_IMPORTED_KEYS = 10 +GET_INDEX_INFO = 11 +GET_PRIMARY_KEYS = 12 +GET_PROCEDURE_COLUMNS = 13 +GET_PROCEDURES = 14 +GET_PSEUDO_COLUMNS = 15 +GET_SCHEMAS = 16 +GET_SCHEMAS_WITH_ARGS = 17 +GET_SUPER_TABLES = 18 +GET_SUPER_TYPES = 19 +GET_TABLE_PRIVILEGES = 20 +GET_TABLES = 21 +GET_TABLE_TYPES = 22 +GET_TYPE_INFO = 23 +GET_UDTS = 24 +GET_VERSION_COLUMNS = 25 +SQL = 0 +METADATA = 1 + + +_CURSORFACTORY_STYLE = _descriptor.EnumDescriptor( + name='Style', + full_name='CursorFactory.Style', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='OBJECT', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RECORD', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RECORD_PROJECTION', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ARRAY', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LIST', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MAP', index=5, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1278, + serialized_end=1362, +) +_sym_db.RegisterEnumDescriptor(_CURSORFACTORY_STYLE) + +_METADATAOPERATIONARGUMENT_ARGUMENTTYPE = _descriptor.EnumDescriptor( + name='ArgumentType', + full_name='MetaDataOperationArgument.ArgumentType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='STRING', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BOOL', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='REPEATED_STRING', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='REPEATED_INT', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NULL', index=5, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2061, + serialized_end=2155, +) +_sym_db.RegisterEnumDescriptor(_METADATAOPERATIONARGUMENT_ARGUMENTTYPE) + + +_CONNECTIONPROPERTIES = _descriptor.Descriptor( + name='ConnectionProperties', + full_name='ConnectionProperties', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='is_dirty', full_name='ConnectionProperties.is_dirty', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='auto_commit', full_name='ConnectionProperties.auto_commit', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_auto_commit', full_name='ConnectionProperties.has_auto_commit', index=2, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='read_only', full_name='ConnectionProperties.read_only', index=3, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_read_only', full_name='ConnectionProperties.has_read_only', index=4, + number=8, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='transaction_isolation', full_name='ConnectionProperties.transaction_isolation', index=5, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='catalog', full_name='ConnectionProperties.catalog', index=6, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='schema', full_name='ConnectionProperties.schema', index=7, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=17, + serialized_end=209, +) + + +_STATEMENTHANDLE = _descriptor.Descriptor( + name='StatementHandle', + full_name='StatementHandle', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='StatementHandle.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='StatementHandle.id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='signature', full_name='StatementHandle.signature', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=211, + serialized_end=294, +) + + +_SIGNATURE = _descriptor.Descriptor( + name='Signature', + full_name='Signature', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='columns', full_name='Signature.columns', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sql', full_name='Signature.sql', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameters', full_name='Signature.parameters', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='cursor_factory', full_name='Signature.cursor_factory', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statementType', full_name='Signature.statementType', index=4, + number=5, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=297, + serialized_end=473, +) + + +_COLUMNMETADATA = _descriptor.Descriptor( + name='ColumnMetaData', + full_name='ColumnMetaData', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ordinal', full_name='ColumnMetaData.ordinal', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='auto_increment', full_name='ColumnMetaData.auto_increment', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='case_sensitive', full_name='ColumnMetaData.case_sensitive', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='searchable', full_name='ColumnMetaData.searchable', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='currency', full_name='ColumnMetaData.currency', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='nullable', full_name='ColumnMetaData.nullable', index=5, + number=6, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='signed', full_name='ColumnMetaData.signed', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='display_size', full_name='ColumnMetaData.display_size', index=7, + number=8, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='label', full_name='ColumnMetaData.label', index=8, + number=9, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='column_name', full_name='ColumnMetaData.column_name', index=9, + number=10, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='schema_name', full_name='ColumnMetaData.schema_name', index=10, + number=11, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='precision', full_name='ColumnMetaData.precision', index=11, + number=12, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='ColumnMetaData.scale', index=12, + number=13, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='table_name', full_name='ColumnMetaData.table_name', index=13, + number=14, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='catalog_name', full_name='ColumnMetaData.catalog_name', index=14, + number=15, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='read_only', full_name='ColumnMetaData.read_only', index=15, + number=16, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='writable', full_name='ColumnMetaData.writable', index=16, + number=17, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='definitely_writable', full_name='ColumnMetaData.definitely_writable', index=17, + number=18, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='column_class_name', full_name='ColumnMetaData.column_class_name', index=18, + number=19, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='ColumnMetaData.type', index=19, + number=20, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=476, + serialized_end=905, +) + + +_AVATICATYPE = _descriptor.Descriptor( + name='AvaticaType', + full_name='AvaticaType', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='AvaticaType.id', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='AvaticaType.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rep', full_name='AvaticaType.rep', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='columns', full_name='AvaticaType.columns', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='component', full_name='AvaticaType.component', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=907, + serialized_end=1032, +) + + +_AVATICAPARAMETER = _descriptor.Descriptor( + name='AvaticaParameter', + full_name='AvaticaParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='signed', full_name='AvaticaParameter.signed', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='precision', full_name='AvaticaParameter.precision', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scale', full_name='AvaticaParameter.scale', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_type', full_name='AvaticaParameter.parameter_type', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type_name', full_name='AvaticaParameter.type_name', index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='class_name', full_name='AvaticaParameter.class_name', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='AvaticaParameter.name', index=6, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1035, + serialized_end=1180, +) + + +_CURSORFACTORY = _descriptor.Descriptor( + name='CursorFactory', + full_name='CursorFactory', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='style', full_name='CursorFactory.style', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='class_name', full_name='CursorFactory.class_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='field_names', full_name='CursorFactory.field_names', index=2, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _CURSORFACTORY_STYLE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1183, + serialized_end=1362, +) + + +_FRAME = _descriptor.Descriptor( + name='Frame', + full_name='Frame', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='offset', full_name='Frame.offset', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='done', full_name='Frame.done', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rows', full_name='Frame.rows', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1364, + serialized_end=1421, +) + + +_ROW = _descriptor.Descriptor( + name='Row', + full_name='Row', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='value', full_name='Row.value', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1423, + serialized_end=1457, +) + + +_DATABASEPROPERTY = _descriptor.Descriptor( + name='DatabaseProperty', + full_name='DatabaseProperty', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='DatabaseProperty.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='functions', full_name='DatabaseProperty.functions', index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1459, + serialized_end=1510, +) + + +_WIREMESSAGE = _descriptor.Descriptor( + name='WireMessage', + full_name='WireMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='WireMessage.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='wrapped_message', full_name='WireMessage.wrapped_message', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1512, + serialized_end=1564, +) + + +_COLUMNVALUE = _descriptor.Descriptor( + name='ColumnValue', + full_name='ColumnValue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='value', full_name='ColumnValue.value', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='array_value', full_name='ColumnValue.array_value', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_array_value', full_name='ColumnValue.has_array_value', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scalar_value', full_name='ColumnValue.scalar_value', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1567, + serialized_end=1702, +) + + +_TYPEDVALUE = _descriptor.Descriptor( + name='TypedValue', + full_name='TypedValue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='TypedValue.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bool_value', full_name='TypedValue.bool_value', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='string_value', full_name='TypedValue.string_value', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='number_value', full_name='TypedValue.number_value', index=3, + number=4, type=18, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bytes_value', full_name='TypedValue.bytes_value', index=4, + number=5, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='double_value', full_name='TypedValue.double_value', index=5, + number=6, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='null', full_name='TypedValue.null', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1705, + serialized_end=1858, +) + + +_METADATAOPERATIONARGUMENT = _descriptor.Descriptor( + name='MetaDataOperationArgument', + full_name='MetaDataOperationArgument', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='string_value', full_name='MetaDataOperationArgument.string_value', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bool_value', full_name='MetaDataOperationArgument.bool_value', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='int_value', full_name='MetaDataOperationArgument.int_value', index=2, + number=3, type=17, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='string_array_values', full_name='MetaDataOperationArgument.string_array_values', index=3, + number=4, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='int_array_values', full_name='MetaDataOperationArgument.int_array_values', index=4, + number=5, type=17, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='MetaDataOperationArgument.type', index=5, + number=6, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _METADATAOPERATIONARGUMENT_ARGUMENTTYPE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1861, + serialized_end=2155, +) + + +_QUERYSTATE = _descriptor.Descriptor( + name='QueryState', + full_name='QueryState', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='QueryState.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sql', full_name='QueryState.sql', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='op', full_name='QueryState.op', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='args', full_name='QueryState.args', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_args', full_name='QueryState.has_args', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_sql', full_name='QueryState.has_sql', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_op', full_name='QueryState.has_op', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2158, + serialized_end=2334, +) + +_STATEMENTHANDLE.fields_by_name['signature'].message_type = _SIGNATURE +_SIGNATURE.fields_by_name['columns'].message_type = _COLUMNMETADATA +_SIGNATURE.fields_by_name['parameters'].message_type = _AVATICAPARAMETER +_SIGNATURE.fields_by_name['cursor_factory'].message_type = _CURSORFACTORY +_SIGNATURE.fields_by_name['statementType'].enum_type = _STATEMENTTYPE +_COLUMNMETADATA.fields_by_name['type'].message_type = _AVATICATYPE +_AVATICATYPE.fields_by_name['rep'].enum_type = _REP +_AVATICATYPE.fields_by_name['columns'].message_type = _COLUMNMETADATA +_AVATICATYPE.fields_by_name['component'].message_type = _AVATICATYPE +_CURSORFACTORY.fields_by_name['style'].enum_type = _CURSORFACTORY_STYLE +_CURSORFACTORY_STYLE.containing_type = _CURSORFACTORY +_FRAME.fields_by_name['rows'].message_type = _ROW +_ROW.fields_by_name['value'].message_type = _COLUMNVALUE +_COLUMNVALUE.fields_by_name['value'].message_type = _TYPEDVALUE +_COLUMNVALUE.fields_by_name['array_value'].message_type = _TYPEDVALUE +_COLUMNVALUE.fields_by_name['scalar_value'].message_type = _TYPEDVALUE +_TYPEDVALUE.fields_by_name['type'].enum_type = _REP +_METADATAOPERATIONARGUMENT.fields_by_name['type'].enum_type = _METADATAOPERATIONARGUMENT_ARGUMENTTYPE +_METADATAOPERATIONARGUMENT_ARGUMENTTYPE.containing_type = _METADATAOPERATIONARGUMENT +_QUERYSTATE.fields_by_name['type'].enum_type = _STATETYPE +_QUERYSTATE.fields_by_name['op'].enum_type = _METADATAOPERATION +_QUERYSTATE.fields_by_name['args'].message_type = _METADATAOPERATIONARGUMENT +DESCRIPTOR.message_types_by_name['ConnectionProperties'] = _CONNECTIONPROPERTIES +DESCRIPTOR.message_types_by_name['StatementHandle'] = _STATEMENTHANDLE +DESCRIPTOR.message_types_by_name['Signature'] = _SIGNATURE +DESCRIPTOR.message_types_by_name['ColumnMetaData'] = _COLUMNMETADATA +DESCRIPTOR.message_types_by_name['AvaticaType'] = _AVATICATYPE +DESCRIPTOR.message_types_by_name['AvaticaParameter'] = _AVATICAPARAMETER +DESCRIPTOR.message_types_by_name['CursorFactory'] = _CURSORFACTORY +DESCRIPTOR.message_types_by_name['Frame'] = _FRAME +DESCRIPTOR.message_types_by_name['Row'] = _ROW +DESCRIPTOR.message_types_by_name['DatabaseProperty'] = _DATABASEPROPERTY +DESCRIPTOR.message_types_by_name['WireMessage'] = _WIREMESSAGE +DESCRIPTOR.message_types_by_name['ColumnValue'] = _COLUMNVALUE +DESCRIPTOR.message_types_by_name['TypedValue'] = _TYPEDVALUE +DESCRIPTOR.message_types_by_name['MetaDataOperationArgument'] = _METADATAOPERATIONARGUMENT +DESCRIPTOR.message_types_by_name['QueryState'] = _QUERYSTATE +DESCRIPTOR.enum_types_by_name['StatementType'] = _STATEMENTTYPE +DESCRIPTOR.enum_types_by_name['Rep'] = _REP +DESCRIPTOR.enum_types_by_name['Severity'] = _SEVERITY +DESCRIPTOR.enum_types_by_name['MetaDataOperation'] = _METADATAOPERATION +DESCRIPTOR.enum_types_by_name['StateType'] = _STATETYPE + +ConnectionProperties = _reflection.GeneratedProtocolMessageType('ConnectionProperties', (_message.Message,), dict( + DESCRIPTOR = _CONNECTIONPROPERTIES, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:ConnectionProperties) + )) +_sym_db.RegisterMessage(ConnectionProperties) + +StatementHandle = _reflection.GeneratedProtocolMessageType('StatementHandle', (_message.Message,), dict( + DESCRIPTOR = _STATEMENTHANDLE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:StatementHandle) + )) +_sym_db.RegisterMessage(StatementHandle) + +Signature = _reflection.GeneratedProtocolMessageType('Signature', (_message.Message,), dict( + DESCRIPTOR = _SIGNATURE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:Signature) + )) +_sym_db.RegisterMessage(Signature) + +ColumnMetaData = _reflection.GeneratedProtocolMessageType('ColumnMetaData', (_message.Message,), dict( + DESCRIPTOR = _COLUMNMETADATA, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:ColumnMetaData) + )) +_sym_db.RegisterMessage(ColumnMetaData) + +AvaticaType = _reflection.GeneratedProtocolMessageType('AvaticaType', (_message.Message,), dict( + DESCRIPTOR = _AVATICATYPE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:AvaticaType) + )) +_sym_db.RegisterMessage(AvaticaType) + +AvaticaParameter = _reflection.GeneratedProtocolMessageType('AvaticaParameter', (_message.Message,), dict( + DESCRIPTOR = _AVATICAPARAMETER, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:AvaticaParameter) + )) +_sym_db.RegisterMessage(AvaticaParameter) + +CursorFactory = _reflection.GeneratedProtocolMessageType('CursorFactory', (_message.Message,), dict( + DESCRIPTOR = _CURSORFACTORY, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:CursorFactory) + )) +_sym_db.RegisterMessage(CursorFactory) + +Frame = _reflection.GeneratedProtocolMessageType('Frame', (_message.Message,), dict( + DESCRIPTOR = _FRAME, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:Frame) + )) +_sym_db.RegisterMessage(Frame) + +Row = _reflection.GeneratedProtocolMessageType('Row', (_message.Message,), dict( + DESCRIPTOR = _ROW, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:Row) + )) +_sym_db.RegisterMessage(Row) + +DatabaseProperty = _reflection.GeneratedProtocolMessageType('DatabaseProperty', (_message.Message,), dict( + DESCRIPTOR = _DATABASEPROPERTY, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:DatabaseProperty) + )) +_sym_db.RegisterMessage(DatabaseProperty) + +WireMessage = _reflection.GeneratedProtocolMessageType('WireMessage', (_message.Message,), dict( + DESCRIPTOR = _WIREMESSAGE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:WireMessage) + )) +_sym_db.RegisterMessage(WireMessage) + +ColumnValue = _reflection.GeneratedProtocolMessageType('ColumnValue', (_message.Message,), dict( + DESCRIPTOR = _COLUMNVALUE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:ColumnValue) + )) +_sym_db.RegisterMessage(ColumnValue) + +TypedValue = _reflection.GeneratedProtocolMessageType('TypedValue', (_message.Message,), dict( + DESCRIPTOR = _TYPEDVALUE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:TypedValue) + )) +_sym_db.RegisterMessage(TypedValue) + +MetaDataOperationArgument = _reflection.GeneratedProtocolMessageType('MetaDataOperationArgument', (_message.Message,), dict( + DESCRIPTOR = _METADATAOPERATIONARGUMENT, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:MetaDataOperationArgument) + )) +_sym_db.RegisterMessage(MetaDataOperationArgument) + +QueryState = _reflection.GeneratedProtocolMessageType('QueryState', (_message.Message,), dict( + DESCRIPTOR = _QUERYSTATE, + __module__ = 'common_pb2' + # @@protoc_insertion_point(class_scope:QueryState) + )) +_sym_db.RegisterMessage(QueryState) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n org.apache.calcite.avatica.proto')) +# @@protoc_insertion_point(module_scope) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/requests_pb2.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/requests_pb2.py new file mode 100644 index 00000000..beb1b928 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/requests_pb2.py @@ -0,0 +1,1199 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: requests.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import common_pb2 as common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='requests.proto', + package='', + syntax='proto3', + serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 \x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 \x01(\t\x12\x15\n\rconnection_id\x18\x03 \x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 \x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 \x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 \x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 \x01(\x08\x12\x15\n\rconnection_id\x18\x07 \x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 \x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 \x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 \x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 \x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 \x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 \x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 \x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 \x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 \x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 \x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 \x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 \x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 \x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15OpenConnectionRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 .OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12)\n\nconn_props\x18\x02 \x01(\x0b\x32\x15.ConnectionProperties\"\x9e\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 \x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x14\x66irst_frame_max_size\x18\x03 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 \x01(\x08\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 \x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommitRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x14\n\x0csql_commands\x18\x03 \x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 \x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 \x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3') + , + dependencies=[common__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_CATALOGSREQUEST = _descriptor.Descriptor( + name='CatalogsRequest', + full_name='CatalogsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='CatalogsRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=32, + serialized_end=72, +) + + +_DATABASEPROPERTYREQUEST = _descriptor.Descriptor( + name='DatabasePropertyRequest', + full_name='DatabasePropertyRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='DatabasePropertyRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=74, + serialized_end=122, +) + + +_SCHEMASREQUEST = _descriptor.Descriptor( + name='SchemasRequest', + full_name='SchemasRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='catalog', full_name='SchemasRequest.catalog', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='schema_pattern', full_name='SchemasRequest.schema_pattern', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='connection_id', full_name='SchemasRequest.connection_id', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=124, + serialized_end=204, +) + + +_TABLESREQUEST = _descriptor.Descriptor( + name='TablesRequest', + full_name='TablesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='catalog', full_name='TablesRequest.catalog', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='schema_pattern', full_name='TablesRequest.schema_pattern', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='table_name_pattern', full_name='TablesRequest.table_name_pattern', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type_list', full_name='TablesRequest.type_list', index=3, + number=4, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_type_list', full_name='TablesRequest.has_type_list', index=4, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='connection_id', full_name='TablesRequest.connection_id', index=5, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=207, + serialized_end=356, +) + + +_TABLETYPESREQUEST = _descriptor.Descriptor( + name='TableTypesRequest', + full_name='TableTypesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='TableTypesRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=358, + serialized_end=400, +) + + +_COLUMNSREQUEST = _descriptor.Descriptor( + name='ColumnsRequest', + full_name='ColumnsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='catalog', full_name='ColumnsRequest.catalog', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='schema_pattern', full_name='ColumnsRequest.schema_pattern', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='table_name_pattern', full_name='ColumnsRequest.table_name_pattern', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='column_name_pattern', full_name='ColumnsRequest.column_name_pattern', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='connection_id', full_name='ColumnsRequest.connection_id', index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=403, + serialized_end=540, +) + + +_TYPEINFOREQUEST = _descriptor.Descriptor( + name='TypeInfoRequest', + full_name='TypeInfoRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='TypeInfoRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=542, + serialized_end=582, +) + + +_PREPAREANDEXECUTEREQUEST = _descriptor.Descriptor( + name='PrepareAndExecuteRequest', + full_name='PrepareAndExecuteRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='PrepareAndExecuteRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sql', full_name='PrepareAndExecuteRequest.sql', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_row_count', full_name='PrepareAndExecuteRequest.max_row_count', index=2, + number=3, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='PrepareAndExecuteRequest.statement_id', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_rows_total', full_name='PrepareAndExecuteRequest.max_rows_total', index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='first_frame_max_size', full_name='PrepareAndExecuteRequest.first_frame_max_size', index=5, + number=6, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=585, + serialized_end=746, +) + + +_PREPAREREQUEST = _descriptor.Descriptor( + name='PrepareRequest', + full_name='PrepareRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='PrepareRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sql', full_name='PrepareRequest.sql', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_row_count', full_name='PrepareRequest.max_row_count', index=2, + number=3, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_rows_total', full_name='PrepareRequest.max_rows_total', index=3, + number=4, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=748, + serialized_end=847, +) + + +_FETCHREQUEST = _descriptor.Descriptor( + name='FetchRequest', + full_name='FetchRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='FetchRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='FetchRequest.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='offset', full_name='FetchRequest.offset', index=2, + number=3, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='fetch_max_row_count', full_name='FetchRequest.fetch_max_row_count', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='frame_max_size', full_name='FetchRequest.frame_max_size', index=4, + number=5, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=850, + serialized_end=978, +) + + +_CREATESTATEMENTREQUEST = _descriptor.Descriptor( + name='CreateStatementRequest', + full_name='CreateStatementRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='CreateStatementRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=980, + serialized_end=1027, +) + + +_CLOSESTATEMENTREQUEST = _descriptor.Descriptor( + name='CloseStatementRequest', + full_name='CloseStatementRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='CloseStatementRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='CloseStatementRequest.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1029, + serialized_end=1097, +) + + +_OPENCONNECTIONREQUEST_INFOENTRY = _descriptor.Descriptor( + name='InfoEntry', + full_name='OpenConnectionRequest.InfoEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='OpenConnectionRequest.InfoEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='OpenConnectionRequest.InfoEntry.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')), + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1196, + serialized_end=1239, +) + +_OPENCONNECTIONREQUEST = _descriptor.Descriptor( + name='OpenConnectionRequest', + full_name='OpenConnectionRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='OpenConnectionRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='info', full_name='OpenConnectionRequest.info', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_OPENCONNECTIONREQUEST_INFOENTRY, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1100, + serialized_end=1239, +) + + +_CLOSECONNECTIONREQUEST = _descriptor.Descriptor( + name='CloseConnectionRequest', + full_name='CloseConnectionRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='CloseConnectionRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1241, + serialized_end=1288, +) + + +_CONNECTIONSYNCREQUEST = _descriptor.Descriptor( + name='ConnectionSyncRequest', + full_name='ConnectionSyncRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='ConnectionSyncRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='conn_props', full_name='ConnectionSyncRequest.conn_props', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1290, + serialized_end=1379, +) + + +_EXECUTEREQUEST = _descriptor.Descriptor( + name='ExecuteRequest', + full_name='ExecuteRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='statementHandle', full_name='ExecuteRequest.statementHandle', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_values', full_name='ExecuteRequest.parameter_values', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='first_frame_max_size', full_name='ExecuteRequest.first_frame_max_size', index=2, + number=3, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_parameter_values', full_name='ExecuteRequest.has_parameter_values', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1382, + serialized_end=1540, +) + + +_SYNCRESULTSREQUEST = _descriptor.Descriptor( + name='SyncResultsRequest', + full_name='SyncResultsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='SyncResultsRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='SyncResultsRequest.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='state', full_name='SyncResultsRequest.state', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='offset', full_name='SyncResultsRequest.offset', index=3, + number=4, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1542, + serialized_end=1651, +) + + +_COMMITREQUEST = _descriptor.Descriptor( + name='CommitRequest', + full_name='CommitRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='CommitRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1653, + serialized_end=1691, +) + + +_ROLLBACKREQUEST = _descriptor.Descriptor( + name='RollbackRequest', + full_name='RollbackRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='RollbackRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1693, + serialized_end=1733, +) + + +_PREPAREANDEXECUTEBATCHREQUEST = _descriptor.Descriptor( + name='PrepareAndExecuteBatchRequest', + full_name='PrepareAndExecuteBatchRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='PrepareAndExecuteBatchRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='PrepareAndExecuteBatchRequest.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sql_commands', full_name='PrepareAndExecuteBatchRequest.sql_commands', index=2, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1735, + serialized_end=1833, +) + + +_UPDATEBATCH = _descriptor.Descriptor( + name='UpdateBatch', + full_name='UpdateBatch', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='parameter_values', full_name='UpdateBatch.parameter_values', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1835, + serialized_end=1887, +) + + +_EXECUTEBATCHREQUEST = _descriptor.Descriptor( + name='ExecuteBatchRequest', + full_name='ExecuteBatchRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='ExecuteBatchRequest.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='ExecuteBatchRequest.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='updates', full_name='ExecuteBatchRequest.updates', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1889, + serialized_end=1986, +) + +_OPENCONNECTIONREQUEST_INFOENTRY.containing_type = _OPENCONNECTIONREQUEST +_OPENCONNECTIONREQUEST.fields_by_name['info'].message_type = _OPENCONNECTIONREQUEST_INFOENTRY +_CONNECTIONSYNCREQUEST.fields_by_name['conn_props'].message_type = common__pb2._CONNECTIONPROPERTIES +_EXECUTEREQUEST.fields_by_name['statementHandle'].message_type = common__pb2._STATEMENTHANDLE +_EXECUTEREQUEST.fields_by_name['parameter_values'].message_type = common__pb2._TYPEDVALUE +_SYNCRESULTSREQUEST.fields_by_name['state'].message_type = common__pb2._QUERYSTATE +_UPDATEBATCH.fields_by_name['parameter_values'].message_type = common__pb2._TYPEDVALUE +_EXECUTEBATCHREQUEST.fields_by_name['updates'].message_type = _UPDATEBATCH +DESCRIPTOR.message_types_by_name['CatalogsRequest'] = _CATALOGSREQUEST +DESCRIPTOR.message_types_by_name['DatabasePropertyRequest'] = _DATABASEPROPERTYREQUEST +DESCRIPTOR.message_types_by_name['SchemasRequest'] = _SCHEMASREQUEST +DESCRIPTOR.message_types_by_name['TablesRequest'] = _TABLESREQUEST +DESCRIPTOR.message_types_by_name['TableTypesRequest'] = _TABLETYPESREQUEST +DESCRIPTOR.message_types_by_name['ColumnsRequest'] = _COLUMNSREQUEST +DESCRIPTOR.message_types_by_name['TypeInfoRequest'] = _TYPEINFOREQUEST +DESCRIPTOR.message_types_by_name['PrepareAndExecuteRequest'] = _PREPAREANDEXECUTEREQUEST +DESCRIPTOR.message_types_by_name['PrepareRequest'] = _PREPAREREQUEST +DESCRIPTOR.message_types_by_name['FetchRequest'] = _FETCHREQUEST +DESCRIPTOR.message_types_by_name['CreateStatementRequest'] = _CREATESTATEMENTREQUEST +DESCRIPTOR.message_types_by_name['CloseStatementRequest'] = _CLOSESTATEMENTREQUEST +DESCRIPTOR.message_types_by_name['OpenConnectionRequest'] = _OPENCONNECTIONREQUEST +DESCRIPTOR.message_types_by_name['CloseConnectionRequest'] = _CLOSECONNECTIONREQUEST +DESCRIPTOR.message_types_by_name['ConnectionSyncRequest'] = _CONNECTIONSYNCREQUEST +DESCRIPTOR.message_types_by_name['ExecuteRequest'] = _EXECUTEREQUEST +DESCRIPTOR.message_types_by_name['SyncResultsRequest'] = _SYNCRESULTSREQUEST +DESCRIPTOR.message_types_by_name['CommitRequest'] = _COMMITREQUEST +DESCRIPTOR.message_types_by_name['RollbackRequest'] = _ROLLBACKREQUEST +DESCRIPTOR.message_types_by_name['PrepareAndExecuteBatchRequest'] = _PREPAREANDEXECUTEBATCHREQUEST +DESCRIPTOR.message_types_by_name['UpdateBatch'] = _UPDATEBATCH +DESCRIPTOR.message_types_by_name['ExecuteBatchRequest'] = _EXECUTEBATCHREQUEST + +CatalogsRequest = _reflection.GeneratedProtocolMessageType('CatalogsRequest', (_message.Message,), dict( + DESCRIPTOR = _CATALOGSREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:CatalogsRequest) + )) +_sym_db.RegisterMessage(CatalogsRequest) + +DatabasePropertyRequest = _reflection.GeneratedProtocolMessageType('DatabasePropertyRequest', (_message.Message,), dict( + DESCRIPTOR = _DATABASEPROPERTYREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:DatabasePropertyRequest) + )) +_sym_db.RegisterMessage(DatabasePropertyRequest) + +SchemasRequest = _reflection.GeneratedProtocolMessageType('SchemasRequest', (_message.Message,), dict( + DESCRIPTOR = _SCHEMASREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:SchemasRequest) + )) +_sym_db.RegisterMessage(SchemasRequest) + +TablesRequest = _reflection.GeneratedProtocolMessageType('TablesRequest', (_message.Message,), dict( + DESCRIPTOR = _TABLESREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:TablesRequest) + )) +_sym_db.RegisterMessage(TablesRequest) + +TableTypesRequest = _reflection.GeneratedProtocolMessageType('TableTypesRequest', (_message.Message,), dict( + DESCRIPTOR = _TABLETYPESREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:TableTypesRequest) + )) +_sym_db.RegisterMessage(TableTypesRequest) + +ColumnsRequest = _reflection.GeneratedProtocolMessageType('ColumnsRequest', (_message.Message,), dict( + DESCRIPTOR = _COLUMNSREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:ColumnsRequest) + )) +_sym_db.RegisterMessage(ColumnsRequest) + +TypeInfoRequest = _reflection.GeneratedProtocolMessageType('TypeInfoRequest', (_message.Message,), dict( + DESCRIPTOR = _TYPEINFOREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:TypeInfoRequest) + )) +_sym_db.RegisterMessage(TypeInfoRequest) + +PrepareAndExecuteRequest = _reflection.GeneratedProtocolMessageType('PrepareAndExecuteRequest', (_message.Message,), dict( + DESCRIPTOR = _PREPAREANDEXECUTEREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:PrepareAndExecuteRequest) + )) +_sym_db.RegisterMessage(PrepareAndExecuteRequest) + +PrepareRequest = _reflection.GeneratedProtocolMessageType('PrepareRequest', (_message.Message,), dict( + DESCRIPTOR = _PREPAREREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:PrepareRequest) + )) +_sym_db.RegisterMessage(PrepareRequest) + +FetchRequest = _reflection.GeneratedProtocolMessageType('FetchRequest', (_message.Message,), dict( + DESCRIPTOR = _FETCHREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:FetchRequest) + )) +_sym_db.RegisterMessage(FetchRequest) + +CreateStatementRequest = _reflection.GeneratedProtocolMessageType('CreateStatementRequest', (_message.Message,), dict( + DESCRIPTOR = _CREATESTATEMENTREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:CreateStatementRequest) + )) +_sym_db.RegisterMessage(CreateStatementRequest) + +CloseStatementRequest = _reflection.GeneratedProtocolMessageType('CloseStatementRequest', (_message.Message,), dict( + DESCRIPTOR = _CLOSESTATEMENTREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:CloseStatementRequest) + )) +_sym_db.RegisterMessage(CloseStatementRequest) + +OpenConnectionRequest = _reflection.GeneratedProtocolMessageType('OpenConnectionRequest', (_message.Message,), dict( + + InfoEntry = _reflection.GeneratedProtocolMessageType('InfoEntry', (_message.Message,), dict( + DESCRIPTOR = _OPENCONNECTIONREQUEST_INFOENTRY, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:OpenConnectionRequest.InfoEntry) + )) + , + DESCRIPTOR = _OPENCONNECTIONREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:OpenConnectionRequest) + )) +_sym_db.RegisterMessage(OpenConnectionRequest) +_sym_db.RegisterMessage(OpenConnectionRequest.InfoEntry) + +CloseConnectionRequest = _reflection.GeneratedProtocolMessageType('CloseConnectionRequest', (_message.Message,), dict( + DESCRIPTOR = _CLOSECONNECTIONREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:CloseConnectionRequest) + )) +_sym_db.RegisterMessage(CloseConnectionRequest) + +ConnectionSyncRequest = _reflection.GeneratedProtocolMessageType('ConnectionSyncRequest', (_message.Message,), dict( + DESCRIPTOR = _CONNECTIONSYNCREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:ConnectionSyncRequest) + )) +_sym_db.RegisterMessage(ConnectionSyncRequest) + +ExecuteRequest = _reflection.GeneratedProtocolMessageType('ExecuteRequest', (_message.Message,), dict( + DESCRIPTOR = _EXECUTEREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:ExecuteRequest) + )) +_sym_db.RegisterMessage(ExecuteRequest) + +SyncResultsRequest = _reflection.GeneratedProtocolMessageType('SyncResultsRequest', (_message.Message,), dict( + DESCRIPTOR = _SYNCRESULTSREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:SyncResultsRequest) + )) +_sym_db.RegisterMessage(SyncResultsRequest) + +CommitRequest = _reflection.GeneratedProtocolMessageType('CommitRequest', (_message.Message,), dict( + DESCRIPTOR = _COMMITREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:CommitRequest) + )) +_sym_db.RegisterMessage(CommitRequest) + +RollbackRequest = _reflection.GeneratedProtocolMessageType('RollbackRequest', (_message.Message,), dict( + DESCRIPTOR = _ROLLBACKREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:RollbackRequest) + )) +_sym_db.RegisterMessage(RollbackRequest) + +PrepareAndExecuteBatchRequest = _reflection.GeneratedProtocolMessageType('PrepareAndExecuteBatchRequest', (_message.Message,), dict( + DESCRIPTOR = _PREPAREANDEXECUTEBATCHREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:PrepareAndExecuteBatchRequest) + )) +_sym_db.RegisterMessage(PrepareAndExecuteBatchRequest) + +UpdateBatch = _reflection.GeneratedProtocolMessageType('UpdateBatch', (_message.Message,), dict( + DESCRIPTOR = _UPDATEBATCH, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:UpdateBatch) + )) +_sym_db.RegisterMessage(UpdateBatch) + +ExecuteBatchRequest = _reflection.GeneratedProtocolMessageType('ExecuteBatchRequest', (_message.Message,), dict( + DESCRIPTOR = _EXECUTEBATCHREQUEST, + __module__ = 'requests_pb2' + # @@protoc_insertion_point(class_scope:ExecuteBatchRequest) + )) +_sym_db.RegisterMessage(ExecuteBatchRequest) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n org.apache.calcite.avatica.proto')) +_OPENCONNECTIONREQUEST_INFOENTRY.has_options = True +_OPENCONNECTIONREQUEST_INFOENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) +# @@protoc_insertion_point(module_scope) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/responses_pb2.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/responses_pb2.py new file mode 100644 index 00000000..e0259b96 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/calcite/responses_pb2.py @@ -0,0 +1,917 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: responses.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import common_pb2 as common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='responses.proto', + package='', + syntax='proto3', + serialized_pb=_b('\n\x0fresponses.proto\x1a\x0c\x63ommon.proto\"\xc9\x01\n\x11ResultSetResponse\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x15\n\rown_statement\x18\x03 \x01(\x08\x12\x1d\n\tsignature\x18\x04 \x01(\x0b\x32\n.Signature\x12\x1b\n\x0b\x66irst_frame\x18\x05 \x01(\x0b\x32\x06.Frame\x12\x14\n\x0cupdate_count\x18\x06 \x01(\x04\x12\x1e\n\x08metadata\x18\x07 \x01(\x0b\x32\x0c.RpcMetadata\"q\n\x0f\x45xecuteResponse\x12#\n\x07results\x18\x01 \x03(\x0b\x32\x12.ResultSetResponse\x12\x19\n\x11missing_statement\x18\x02 \x01(\x08\x12\x1e\n\x08metadata\x18\x03 \x01(\x0b\x32\x0c.RpcMetadata\"V\n\x0fPrepareResponse\x12#\n\tstatement\x18\x01 \x01(\x0b\x32\x10.StatementHandle\x12\x1e\n\x08metadata\x18\x02 \x01(\x0b\x32\x0c.RpcMetadata\"z\n\rFetchResponse\x12\x15\n\x05\x66rame\x18\x01 \x01(\x0b\x32\x06.Frame\x12\x19\n\x11missing_statement\x18\x02 \x01(\x08\x12\x17\n\x0fmissing_results\x18\x03 \x01(\x08\x12\x1e\n\x08metadata\x18\x04 \x01(\x0b\x32\x0c.RpcMetadata\"f\n\x17\x43reateStatementResponse\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1e\n\x08metadata\x18\x03 \x01(\x0b\x32\x0c.RpcMetadata\"8\n\x16\x43loseStatementResponse\x12\x1e\n\x08metadata\x18\x01 \x01(\x0b\x32\x0c.RpcMetadata\"8\n\x16OpenConnectionResponse\x12\x1e\n\x08metadata\x18\x01 \x01(\x0b\x32\x0c.RpcMetadata\"9\n\x17\x43loseConnectionResponse\x12\x1e\n\x08metadata\x18\x01 \x01(\x0b\x32\x0c.RpcMetadata\"c\n\x16\x43onnectionSyncResponse\x12)\n\nconn_props\x18\x01 \x01(\x0b\x32\x15.ConnectionProperties\x12\x1e\n\x08metadata\x18\x02 \x01(\x0b\x32\x0c.RpcMetadata\"u\n\x17\x44\x61tabasePropertyElement\x12\x1e\n\x03key\x18\x01 \x01(\x0b\x32\x11.DatabaseProperty\x12\x1a\n\x05value\x18\x02 \x01(\x0b\x32\x0b.TypedValue\x12\x1e\n\x08metadata\x18\x03 \x01(\x0b\x32\x0c.RpcMetadata\"c\n\x18\x44\x61tabasePropertyResponse\x12\'\n\x05props\x18\x01 \x03(\x0b\x32\x18.DatabasePropertyElement\x12\x1e\n\x08metadata\x18\x02 \x01(\x0b\x32\x0c.RpcMetadata\"\xb6\x01\n\rErrorResponse\x12\x12\n\nexceptions\x18\x01 \x03(\t\x12\x16\n\x0ehas_exceptions\x18\x07 \x01(\x08\x12\x15\n\rerror_message\x18\x02 \x01(\t\x12\x1b\n\x08severity\x18\x03 \x01(\x0e\x32\t.Severity\x12\x12\n\nerror_code\x18\x04 \x01(\r\x12\x11\n\tsql_state\x18\x05 \x01(\t\x12\x1e\n\x08metadata\x18\x06 \x01(\x0b\x32\x0c.RpcMetadata\"f\n\x13SyncResultsResponse\x12\x19\n\x11missing_statement\x18\x01 \x01(\x08\x12\x14\n\x0cmore_results\x18\x02 \x01(\x08\x12\x1e\n\x08metadata\x18\x03 \x01(\x0b\x32\x0c.RpcMetadata\"%\n\x0bRpcMetadata\x12\x16\n\x0eserver_address\x18\x01 \x01(\t\"\x10\n\x0e\x43ommitResponse\"\x12\n\x10RollbackResponse\"\x95\x01\n\x14\x45xecuteBatchResponse\x12\x15\n\rconnection_id\x18\x01 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x15\n\rupdate_counts\x18\x03 \x03(\x04\x12\x19\n\x11missing_statement\x18\x04 \x01(\x08\x12\x1e\n\x08metadata\x18\x05 \x01(\x0b\x32\x0c.RpcMetadataB\"\n org.apache.calcite.avatica.protob\x06proto3') + , + dependencies=[common__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_RESULTSETRESPONSE = _descriptor.Descriptor( + name='ResultSetResponse', + full_name='ResultSetResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='ResultSetResponse.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='ResultSetResponse.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='own_statement', full_name='ResultSetResponse.own_statement', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='signature', full_name='ResultSetResponse.signature', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='first_frame', full_name='ResultSetResponse.first_frame', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='update_count', full_name='ResultSetResponse.update_count', index=5, + number=6, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='ResultSetResponse.metadata', index=6, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=34, + serialized_end=235, +) + + +_EXECUTERESPONSE = _descriptor.Descriptor( + name='ExecuteResponse', + full_name='ExecuteResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='results', full_name='ExecuteResponse.results', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='missing_statement', full_name='ExecuteResponse.missing_statement', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='ExecuteResponse.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=237, + serialized_end=350, +) + + +_PREPARERESPONSE = _descriptor.Descriptor( + name='PrepareResponse', + full_name='PrepareResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='statement', full_name='PrepareResponse.statement', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='PrepareResponse.metadata', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=352, + serialized_end=438, +) + + +_FETCHRESPONSE = _descriptor.Descriptor( + name='FetchResponse', + full_name='FetchResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='frame', full_name='FetchResponse.frame', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='missing_statement', full_name='FetchResponse.missing_statement', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='missing_results', full_name='FetchResponse.missing_results', index=2, + number=3, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='FetchResponse.metadata', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=440, + serialized_end=562, +) + + +_CREATESTATEMENTRESPONSE = _descriptor.Descriptor( + name='CreateStatementResponse', + full_name='CreateStatementResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='CreateStatementResponse.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='CreateStatementResponse.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='CreateStatementResponse.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=564, + serialized_end=666, +) + + +_CLOSESTATEMENTRESPONSE = _descriptor.Descriptor( + name='CloseStatementResponse', + full_name='CloseStatementResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='metadata', full_name='CloseStatementResponse.metadata', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=668, + serialized_end=724, +) + + +_OPENCONNECTIONRESPONSE = _descriptor.Descriptor( + name='OpenConnectionResponse', + full_name='OpenConnectionResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='metadata', full_name='OpenConnectionResponse.metadata', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=726, + serialized_end=782, +) + + +_CLOSECONNECTIONRESPONSE = _descriptor.Descriptor( + name='CloseConnectionResponse', + full_name='CloseConnectionResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='metadata', full_name='CloseConnectionResponse.metadata', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=784, + serialized_end=841, +) + + +_CONNECTIONSYNCRESPONSE = _descriptor.Descriptor( + name='ConnectionSyncResponse', + full_name='ConnectionSyncResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='conn_props', full_name='ConnectionSyncResponse.conn_props', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='ConnectionSyncResponse.metadata', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=843, + serialized_end=942, +) + + +_DATABASEPROPERTYELEMENT = _descriptor.Descriptor( + name='DatabasePropertyElement', + full_name='DatabasePropertyElement', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='DatabasePropertyElement.key', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='DatabasePropertyElement.value', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='DatabasePropertyElement.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=944, + serialized_end=1061, +) + + +_DATABASEPROPERTYRESPONSE = _descriptor.Descriptor( + name='DatabasePropertyResponse', + full_name='DatabasePropertyResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='props', full_name='DatabasePropertyResponse.props', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='DatabasePropertyResponse.metadata', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1063, + serialized_end=1162, +) + + +_ERRORRESPONSE = _descriptor.Descriptor( + name='ErrorResponse', + full_name='ErrorResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='exceptions', full_name='ErrorResponse.exceptions', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='has_exceptions', full_name='ErrorResponse.has_exceptions', index=1, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='error_message', full_name='ErrorResponse.error_message', index=2, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='severity', full_name='ErrorResponse.severity', index=3, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='error_code', full_name='ErrorResponse.error_code', index=4, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sql_state', full_name='ErrorResponse.sql_state', index=5, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='ErrorResponse.metadata', index=6, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1165, + serialized_end=1347, +) + + +_SYNCRESULTSRESPONSE = _descriptor.Descriptor( + name='SyncResultsResponse', + full_name='SyncResultsResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='missing_statement', full_name='SyncResultsResponse.missing_statement', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='more_results', full_name='SyncResultsResponse.more_results', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='SyncResultsResponse.metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1349, + serialized_end=1451, +) + + +_RPCMETADATA = _descriptor.Descriptor( + name='RpcMetadata', + full_name='RpcMetadata', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='server_address', full_name='RpcMetadata.server_address', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1453, + serialized_end=1490, +) + + +_COMMITRESPONSE = _descriptor.Descriptor( + name='CommitResponse', + full_name='CommitResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1492, + serialized_end=1508, +) + + +_ROLLBACKRESPONSE = _descriptor.Descriptor( + name='RollbackResponse', + full_name='RollbackResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1510, + serialized_end=1528, +) + + +_EXECUTEBATCHRESPONSE = _descriptor.Descriptor( + name='ExecuteBatchResponse', + full_name='ExecuteBatchResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='ExecuteBatchResponse.connection_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='statement_id', full_name='ExecuteBatchResponse.statement_id', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='update_counts', full_name='ExecuteBatchResponse.update_counts', index=2, + number=3, type=4, cpp_type=4, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='missing_statement', full_name='ExecuteBatchResponse.missing_statement', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata', full_name='ExecuteBatchResponse.metadata', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1531, + serialized_end=1680, +) + +_RESULTSETRESPONSE.fields_by_name['signature'].message_type = common__pb2._SIGNATURE +_RESULTSETRESPONSE.fields_by_name['first_frame'].message_type = common__pb2._FRAME +_RESULTSETRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_EXECUTERESPONSE.fields_by_name['results'].message_type = _RESULTSETRESPONSE +_EXECUTERESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_PREPARERESPONSE.fields_by_name['statement'].message_type = common__pb2._STATEMENTHANDLE +_PREPARERESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_FETCHRESPONSE.fields_by_name['frame'].message_type = common__pb2._FRAME +_FETCHRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_CREATESTATEMENTRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_CLOSESTATEMENTRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_OPENCONNECTIONRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_CLOSECONNECTIONRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_CONNECTIONSYNCRESPONSE.fields_by_name['conn_props'].message_type = common__pb2._CONNECTIONPROPERTIES +_CONNECTIONSYNCRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_DATABASEPROPERTYELEMENT.fields_by_name['key'].message_type = common__pb2._DATABASEPROPERTY +_DATABASEPROPERTYELEMENT.fields_by_name['value'].message_type = common__pb2._TYPEDVALUE +_DATABASEPROPERTYELEMENT.fields_by_name['metadata'].message_type = _RPCMETADATA +_DATABASEPROPERTYRESPONSE.fields_by_name['props'].message_type = _DATABASEPROPERTYELEMENT +_DATABASEPROPERTYRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_ERRORRESPONSE.fields_by_name['severity'].enum_type = common__pb2._SEVERITY +_ERRORRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_SYNCRESULTSRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +_EXECUTEBATCHRESPONSE.fields_by_name['metadata'].message_type = _RPCMETADATA +DESCRIPTOR.message_types_by_name['ResultSetResponse'] = _RESULTSETRESPONSE +DESCRIPTOR.message_types_by_name['ExecuteResponse'] = _EXECUTERESPONSE +DESCRIPTOR.message_types_by_name['PrepareResponse'] = _PREPARERESPONSE +DESCRIPTOR.message_types_by_name['FetchResponse'] = _FETCHRESPONSE +DESCRIPTOR.message_types_by_name['CreateStatementResponse'] = _CREATESTATEMENTRESPONSE +DESCRIPTOR.message_types_by_name['CloseStatementResponse'] = _CLOSESTATEMENTRESPONSE +DESCRIPTOR.message_types_by_name['OpenConnectionResponse'] = _OPENCONNECTIONRESPONSE +DESCRIPTOR.message_types_by_name['CloseConnectionResponse'] = _CLOSECONNECTIONRESPONSE +DESCRIPTOR.message_types_by_name['ConnectionSyncResponse'] = _CONNECTIONSYNCRESPONSE +DESCRIPTOR.message_types_by_name['DatabasePropertyElement'] = _DATABASEPROPERTYELEMENT +DESCRIPTOR.message_types_by_name['DatabasePropertyResponse'] = _DATABASEPROPERTYRESPONSE +DESCRIPTOR.message_types_by_name['ErrorResponse'] = _ERRORRESPONSE +DESCRIPTOR.message_types_by_name['SyncResultsResponse'] = _SYNCRESULTSRESPONSE +DESCRIPTOR.message_types_by_name['RpcMetadata'] = _RPCMETADATA +DESCRIPTOR.message_types_by_name['CommitResponse'] = _COMMITRESPONSE +DESCRIPTOR.message_types_by_name['RollbackResponse'] = _ROLLBACKRESPONSE +DESCRIPTOR.message_types_by_name['ExecuteBatchResponse'] = _EXECUTEBATCHRESPONSE + +ResultSetResponse = _reflection.GeneratedProtocolMessageType('ResultSetResponse', (_message.Message,), dict( + DESCRIPTOR = _RESULTSETRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:ResultSetResponse) + )) +_sym_db.RegisterMessage(ResultSetResponse) + +ExecuteResponse = _reflection.GeneratedProtocolMessageType('ExecuteResponse', (_message.Message,), dict( + DESCRIPTOR = _EXECUTERESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:ExecuteResponse) + )) +_sym_db.RegisterMessage(ExecuteResponse) + +PrepareResponse = _reflection.GeneratedProtocolMessageType('PrepareResponse', (_message.Message,), dict( + DESCRIPTOR = _PREPARERESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:PrepareResponse) + )) +_sym_db.RegisterMessage(PrepareResponse) + +FetchResponse = _reflection.GeneratedProtocolMessageType('FetchResponse', (_message.Message,), dict( + DESCRIPTOR = _FETCHRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:FetchResponse) + )) +_sym_db.RegisterMessage(FetchResponse) + +CreateStatementResponse = _reflection.GeneratedProtocolMessageType('CreateStatementResponse', (_message.Message,), dict( + DESCRIPTOR = _CREATESTATEMENTRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:CreateStatementResponse) + )) +_sym_db.RegisterMessage(CreateStatementResponse) + +CloseStatementResponse = _reflection.GeneratedProtocolMessageType('CloseStatementResponse', (_message.Message,), dict( + DESCRIPTOR = _CLOSESTATEMENTRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:CloseStatementResponse) + )) +_sym_db.RegisterMessage(CloseStatementResponse) + +OpenConnectionResponse = _reflection.GeneratedProtocolMessageType('OpenConnectionResponse', (_message.Message,), dict( + DESCRIPTOR = _OPENCONNECTIONRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:OpenConnectionResponse) + )) +_sym_db.RegisterMessage(OpenConnectionResponse) + +CloseConnectionResponse = _reflection.GeneratedProtocolMessageType('CloseConnectionResponse', (_message.Message,), dict( + DESCRIPTOR = _CLOSECONNECTIONRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:CloseConnectionResponse) + )) +_sym_db.RegisterMessage(CloseConnectionResponse) + +ConnectionSyncResponse = _reflection.GeneratedProtocolMessageType('ConnectionSyncResponse', (_message.Message,), dict( + DESCRIPTOR = _CONNECTIONSYNCRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:ConnectionSyncResponse) + )) +_sym_db.RegisterMessage(ConnectionSyncResponse) + +DatabasePropertyElement = _reflection.GeneratedProtocolMessageType('DatabasePropertyElement', (_message.Message,), dict( + DESCRIPTOR = _DATABASEPROPERTYELEMENT, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:DatabasePropertyElement) + )) +_sym_db.RegisterMessage(DatabasePropertyElement) + +DatabasePropertyResponse = _reflection.GeneratedProtocolMessageType('DatabasePropertyResponse', (_message.Message,), dict( + DESCRIPTOR = _DATABASEPROPERTYRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:DatabasePropertyResponse) + )) +_sym_db.RegisterMessage(DatabasePropertyResponse) + +ErrorResponse = _reflection.GeneratedProtocolMessageType('ErrorResponse', (_message.Message,), dict( + DESCRIPTOR = _ERRORRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:ErrorResponse) + )) +_sym_db.RegisterMessage(ErrorResponse) + +SyncResultsResponse = _reflection.GeneratedProtocolMessageType('SyncResultsResponse', (_message.Message,), dict( + DESCRIPTOR = _SYNCRESULTSRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:SyncResultsResponse) + )) +_sym_db.RegisterMessage(SyncResultsResponse) + +RpcMetadata = _reflection.GeneratedProtocolMessageType('RpcMetadata', (_message.Message,), dict( + DESCRIPTOR = _RPCMETADATA, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:RpcMetadata) + )) +_sym_db.RegisterMessage(RpcMetadata) + +CommitResponse = _reflection.GeneratedProtocolMessageType('CommitResponse', (_message.Message,), dict( + DESCRIPTOR = _COMMITRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:CommitResponse) + )) +_sym_db.RegisterMessage(CommitResponse) + +RollbackResponse = _reflection.GeneratedProtocolMessageType('RollbackResponse', (_message.Message,), dict( + DESCRIPTOR = _ROLLBACKRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:RollbackResponse) + )) +_sym_db.RegisterMessage(RollbackResponse) + +ExecuteBatchResponse = _reflection.GeneratedProtocolMessageType('ExecuteBatchResponse', (_message.Message,), dict( + DESCRIPTOR = _EXECUTEBATCHRESPONSE, + __module__ = 'responses_pb2' + # @@protoc_insertion_point(class_scope:ExecuteBatchResponse) + )) +_sym_db.RegisterMessage(ExecuteBatchResponse) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n org.apache.calcite.avatica.proto')) +# @@protoc_insertion_point(module_scope) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/connection.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/connection.py new file mode 100644 index 00000000..9f96cf21 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/connection.py @@ -0,0 +1,186 @@ +# Copyright 2015 Lukas Lalinsky +# +# 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. + +import logging +import uuid +import weakref +from phoenixdb import errors +from phoenixdb.avatica import OPEN_CONNECTION_PROPERTIES +from phoenixdb.cursor import Cursor +from phoenixdb.errors import OperationalError, NotSupportedError, ProgrammingError + +__all__ = ['Connection'] + +logger = logging.getLogger(__name__) + + +class Connection(object): + """Database connection. + + You should not construct this object manually, use :func:`~phoenixdb.connect` instead. + """ + + cursor_factory = None + """ + The default cursor factory used by :meth:`cursor` if the parameter is not specified. + """ + + def __init__(self, client, cursor_factory=None, **kwargs): + self._client = client + self._closed = False + if cursor_factory is not None: + self.cursor_factory = cursor_factory + else: + self.cursor_factory = Cursor + self._cursors = [] + # Extract properties to pass to OpenConnectionRequest + self._connection_args = {} + # The rest of the kwargs + self._filtered_args = {} + for k in kwargs: + if k in OPEN_CONNECTION_PROPERTIES: + self._connection_args[k] = kwargs[k] + else: + self._filtered_args[k] = kwargs[k] + self.open() + self.set_session(**self._filtered_args) + + def __del__(self): + if not self._closed: + self.close() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + if not self._closed: + self.close() + + def open(self): + """Opens the connection.""" + self._id = str(uuid.uuid4()) + self._client.open_connection(self._id, info=self._connection_args) + + def close(self): + """Closes the connection. + No further operations are allowed, either on the connection or any + of its cursors, once the connection is closed. + + If the connection is used in a ``with`` statement, this method will + be automatically called at the end of the ``with`` block. + """ + if self._closed: + raise ProgrammingError('the connection is already closed') + for cursor_ref in self._cursors: + cursor = cursor_ref() + if cursor is not None and not cursor._closed: + cursor.close() + self._client.close_connection(self._id) + self._client.close() + self._closed = True + + @property + def closed(self): + """Read-only attribute specifying if the connection is closed or not.""" + return self._closed + + def commit(self): + """Commits pending database changes. + + Currently, this does nothing, because the RPC does not support + transactions. Only defined for DB API 2.0 compatibility. + You need to use :attr:`autocommit` mode. + """ + # TODO can support be added for this? + if self._closed: + raise ProgrammingError('the connection is already closed') + + def cursor(self, cursor_factory=None): + """Creates a new cursor. + + :param cursor_factory: + This argument can be used to create non-standard cursors. + The class returned must be a subclass of + :class:`~phoenixdb.cursor.Cursor` (for example :class:`~phoenixdb.cursor.DictCursor`). + A default factory for the connection can also be specified using the + :attr:`cursor_factory` attribute. + + :returns: + A :class:`~phoenixdb.cursor.Cursor` object. + """ + if self._closed: + raise ProgrammingError('the connection is already closed') + cursor = (cursor_factory or self.cursor_factory)(self) + self._cursors.append(weakref.ref(cursor, self._cursors.remove)) + return cursor + + def set_session(self, autocommit=None, readonly=None): + """Sets one or more parameters in the current connection. + + :param autocommit: + Switch the connection to autocommit mode. With the current + version, you need to always enable this, because + :meth:`commit` is not implemented. + + :param readonly: + Switch the connection to read-only mode. + """ + props = {} + if autocommit is not None: + props['autoCommit'] = bool(autocommit) + if readonly is not None: + props['readOnly'] = bool(readonly) + props = self._client.connection_sync(self._id, props) + self._autocommit = props.auto_commit + self._readonly = props.read_only + self._transactionisolation = props.transaction_isolation + + @property + def autocommit(self): + """Read/write attribute for switching the connection's autocommit mode.""" + return self._autocommit + + @autocommit.setter + def autocommit(self, value): + if self._closed: + raise ProgrammingError('the connection is already closed') + props = self._client.connection_sync(self._id, {'autoCommit': bool(value)}) + self._autocommit = props.auto_commit + + @property + def readonly(self): + """Read/write attribute for switching the connection's readonly mode.""" + return self._readonly + + @readonly.setter + def readonly(self, value): + if self._closed: + raise ProgrammingError('the connection is already closed') + props = self._client.connection_sync(self._id, {'readOnly': bool(value)}) + self._readonly = props.read_only + + @property + def transactionisolation(self): + return self._transactionisolation + + @readonly.setter + def transactionisolation(self, value): + if self._closed: + raise ProgrammingError('the connection is already closed') + props = self._client.connection_sync(self._id, {'transactionIsolation': bool(value)}) + self._transactionisolation = props.transaction_isolation + + +for name in errors.__all__: + setattr(Connection, name, getattr(errors, name)) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/cursor.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/cursor.py new file mode 100644 index 00000000..bf77728c --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/cursor.py @@ -0,0 +1,340 @@ +# Copyright 2015 Lukas Lalinsky +# +# 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. + +import logging +import collections +from phoenixdb.types import TypeHelper +from phoenixdb.errors import OperationalError, NotSupportedError, ProgrammingError, InternalError +from phoenixdb.calcite import common_pb2 + +__all__ = ['Cursor', 'ColumnDescription', 'DictCursor'] + +logger = logging.getLogger(__name__) + +# TODO see note in Cursor.rowcount() +MAX_INT = 2 ** 64 - 1 + +ColumnDescription = collections.namedtuple('ColumnDescription', 'name type_code display_size internal_size precision scale null_ok') +"""Named tuple for representing results from :attr:`Cursor.description`.""" + +class Cursor(object): + """Database cursor for executing queries and iterating over results. + + You should not construct this object manually, use :meth:`Connection.cursor() ` instead. + """ + + arraysize = 1 + """ + Read/write attribute specifying the number of rows to fetch + at a time with :meth:`fetchmany`. It defaults to 1 meaning to + fetch a single row at a time. + """ + + itersize = 2000 + """ + Read/write attribute specifying the number of rows to fetch + from the backend at each network roundtrip during iteration + on the cursor. The default is 2000. + """ + + def __init__(self, connection, id=None): + self._connection = connection + self._id = id + self._signature = None + self._column_data_types = [] + self._frame = None + self._pos = None + self._closed = False + self.arraysize = self.__class__.arraysize + self.itersize = self.__class__.itersize + self._updatecount = -1 + + def __del__(self): + if not self._connection._closed and not self._closed: + self.close() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + if not self._closed: + self.close() + + def __iter__(self): + return self + + def __next__(self): + row = self.fetchone() + if row is None: + raise StopIteration + return row + + next = __next__ + + def close(self): + """Closes the cursor. + No further operations are allowed once the cursor is closed. + + If the cursor is used in a ``with`` statement, this method will + be automatically called at the end of the ``with`` block. + """ + if self._closed: + raise ProgrammingError('the cursor is already closed') + if self._id is not None: + self._connection._client.close_statement(self._connection._id, self._id) + self._id = None + self._signature = None + self._column_data_types = [] + self._frame = None + self._pos = None + self._closed = True + + @property + def closed(self): + """Read-only attribute specifying if the cursor is closed or not.""" + return self._closed + + @property + def description(self): + if self._signature is None: + return None + description = [] + for column in self._signature.columns: + description.append(ColumnDescription( + column.column_name, + column.type.name, + column.display_size, + None, + column.precision, + column.scale, + None if column.nullable == 2 else bool(column.nullable), + )) + return description + + def _set_id(self, id): + if self._id is not None and self._id != id: + self._connection._client.close_statement(self._connection._id, self._id) + self._id = id + + def _set_signature(self, signature): + self._signature = signature + self._column_data_types = [] + self._parameter_data_types = [] + if signature is None: + return + + for column in signature.columns: + dtype = TypeHelper.from_class(column.column_class_name) + self._column_data_types.append(dtype) + + for parameter in signature.parameters: + dtype = TypeHelper.from_class(parameter.class_name) + self._parameter_data_types.append(dtype) + + def _set_frame(self, frame): + self._frame = frame + self._pos = None + + if frame is not None: + if frame.rows: + self._pos = 0 + elif not frame.done: + raise InternalError('got an empty frame, but the statement is not done yet') + + def _fetch_next_frame(self): + offset = self._frame.offset + len(self._frame.rows) + frame = self._connection._client.fetch(self._connection._id, self._id, + offset=offset, frame_max_size=self.itersize) + self._set_frame(frame) + + def _process_results(self, results): + if results: + result = results[0] + if result.own_statement: + self._set_id(result.statement_id) + self._set_signature(result.signature if result.HasField('signature') else None) + self._set_frame(result.first_frame if result.HasField('first_frame') else None) + self._updatecount = result.update_count + + def _transform_parameters(self, parameters): + typed_parameters = [] + for value, data_type in zip(parameters, self._parameter_data_types): + field_name, rep, mutate_to, cast_from = data_type + typed_value = common_pb2.TypedValue() + + if value is None: + typed_value.null = True + typed_value.type = common_pb2.NULL + else: + typed_value.null = False + + # use the mutator function + if mutate_to is not None: + value = mutate_to(value) + + typed_value.type = rep + setattr(typed_value, field_name, value) + + typed_parameters.append(typed_value) + return typed_parameters + + def execute(self, operation, parameters=None): + if self._closed: + raise ProgrammingError('the cursor is already closed') + self._updatecount = -1 + self._set_frame(None) + if parameters is None: + if self._id is None: + self._set_id(self._connection._client.create_statement(self._connection._id)) + results = self._connection._client.prepare_and_execute(self._connection._id, self._id, + operation, first_frame_max_size=self.itersize) + self._process_results(results) + else: + statement = self._connection._client.prepare(self._connection._id, + operation) + self._set_id(statement.id) + self._set_signature(statement.signature) + + results = self._connection._client.execute(self._connection._id, self._id, + statement.signature, self._transform_parameters(parameters), + first_frame_max_size=self.itersize) + self._process_results(results) + + def executemany(self, operation, seq_of_parameters): + if self._closed: + raise ProgrammingError('the cursor is already closed') + self._updatecount = -1 + self._set_frame(None) + statement = self._connection._client.prepare(self._connection._id, + operation, max_rows_total=0) + self._set_id(statement.id) + self._set_signature(statement.signature) + for parameters in seq_of_parameters: + self._connection._client.execute(self._connection._id, self._id, + statement.signature, self._transform_parameters(parameters), + first_frame_max_size=0) + + def _transform_row(self, row): + """Transforms a Row into Python values. + + :param row: + A ``common_pb2.Row`` object. + + :returns: + A list of values casted into the correct Python types. + + :raises: + NotImplementedError + """ + tmp_row = [] + + for i, column in enumerate(row.value): + if column.has_array_value: + raise NotImplementedError('array types are not supported') + elif column.scalar_value.null: + tmp_row.append(None) + else: + field_name, rep, mutate_to, cast_from = self._column_data_types[i] + + # get the value from the field_name + value = getattr(column.scalar_value, field_name) + + # cast the value + if cast_from is not None: + value = cast_from(value) + + tmp_row.append(value) + return tmp_row + + def fetchone(self): + if self._frame is None: + raise ProgrammingError('no select statement was executed') + if self._pos is None: + return None + rows = self._frame.rows + row = self._transform_row(rows[self._pos]) + self._pos += 1 + if self._pos >= len(rows): + self._pos = None + if not self._frame.done: + self._fetch_next_frame() + return row + + def fetchmany(self, size=None): + if size is None: + size = self.arraysize + rows = [] + while size > 0: + row = self.fetchone() + if row is None: + break + rows.append(row) + size -= 1 + return rows + + def fetchall(self): + rows = [] + while True: + row = self.fetchone() + if row is None: + break + rows.append(row) + return rows + + def setinputsizes(self, sizes): + pass + + def setoutputsize(self, size, column=None): + pass + + @property + def connection(self): + """Read-only attribute providing access to the :class:`Connection ` object this cursor was created from.""" + return self._connection + + @property + def rowcount(self): + """Read-only attribute specifying the number of rows affected by + the last executed DML statement or -1 if the number cannot be + determined. Note that this will always be set to -1 for select + queries.""" + # TODO instead of -1, this ends up being set to Integer.MAX_VALUE + if self._updatecount == MAX_INT: + return -1 + return self._updatecount + + @property + def rownumber(self): + """Read-only attribute providing the current 0-based index of the + cursor in the result set or ``None`` if the index cannot be + determined. + + 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 :attr:`rownumber` in that sequence. + """ + if self._frame is not None and self._pos is not None: + return self._frame.offset + self._pos + return self._pos + + +class DictCursor(Cursor): + """A cursor which returns results as a dictionary""" + + def _transform_row(self, row): + row = super(DictCursor, self)._transform_row(row) + d = {} + for ind, val in enumerate(row): + d[self._signature.columns[ind].column_name] = val + return d diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/errors.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/errors.py new file mode 100644 index 00000000..e7929865 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/errors.py @@ -0,0 +1,92 @@ +# Copyright 2015 Lukas Lalinsky +# +# 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. + +__all__ = [ + 'Warning', 'Error', 'InterfaceError', 'DatabaseError', 'DataError', + 'OperationalError', 'IntegrityError', 'InternalError', + 'ProgrammingError', 'NotSupportedError', +] + +try: + _StandardError = StandardError +except NameError: + _StandardError = Exception + + +class Warning(_StandardError): + """Not used by this package, only defined for compatibility + with DB API 2.0.""" + + +class Error(_StandardError): + """Exception that is the base class of all other error exceptions. + You can use this to catch all errors with one single except statement.""" + + def __init__(self, message, code=None, sqlstate=None, cause=None): + super(_StandardError, self).__init__(message, code, sqlstate, cause) + + @property + def message(self): + return self.args[0] + + @property + def code(self): + return self.args[1] + + @property + def sqlstate(self): + return self.args[2] + + @property + def cause(self): + return self.args[3] + + +class InterfaceError(Error): + """Exception raised for errors that are related to the database + interface rather than the database itself.""" + + +class DatabaseError(Error): + """Exception raised for errors that are related to the database.""" + + +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.""" + + +class OperationalError(DatabaseError): + """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.""" + + +class IntegrityError(DatabaseError): + """Raised when the relational integrity of the database is affected, e.g. a foreign key check fails.""" + + +class InternalError(DatabaseError): + """Raised when the database encounters an internal problem.""" + + +class ProgrammingError(DatabaseError): + """Raises for programming errors, e.g. table not found, syntax error, etc.""" + + +class NotSupportedError(DatabaseError): + """Raised when using an API that is not supported by the database.""" diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__init__.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__init__.py new file mode 100644 index 00000000..50d46f52 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__init__.py @@ -0,0 +1,29 @@ +import os +import unittest +import phoenixdb + +TEST_DB_URL = os.environ.get('PHOENIXDB_TEST_DB_URL') + + +@unittest.skipIf(TEST_DB_URL is None, "these tests require the PHOENIXDB_TEST_DB_URL environment variable set to a clean database") +class DatabaseTestCase(unittest.TestCase): + + def setUp(self): + self.conn = phoenixdb.connect(TEST_DB_URL, autocommit=True) + self.cleanup_tables = [] + + def tearDown(self): + self.doCleanups() + self.conn.close() + + def addTableCleanup(self, name): + def dropTable(): + with self.conn.cursor() as cursor: + cursor.execute("DROP TABLE IF EXISTS {}".format(name)) + self.addCleanup(dropTable) + + def createTable(self, name, columns): + with self.conn.cursor() as cursor: + cursor.execute("DROP TABLE IF EXISTS {}".format(name)) + cursor.execute("CREATE TABLE {} ({})".format(name, columns)) + self.addTableCleanup(name) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/__init__.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 00000000..51213e1c Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/dbapi20.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/dbapi20.cpython-36.pyc new file mode 100644 index 00000000..51c71d50 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/dbapi20.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_avatica.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_avatica.cpython-36.pyc new file mode 100644 index 00000000..943b1560 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_avatica.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_connection.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_connection.cpython-36.pyc new file mode 100644 index 00000000..4d5fc435 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_connection.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_db.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_db.cpython-36.pyc new file mode 100644 index 00000000..28a8051c Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_db.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_dbapi20.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_dbapi20.cpython-36.pyc new file mode 100644 index 00000000..2c909633 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_dbapi20.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_errors.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_errors.cpython-36.pyc new file mode 100644 index 00000000..5d6b68f9 Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_errors.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_types.cpython-36.pyc b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_types.cpython-36.pyc new file mode 100644 index 00000000..7e9cab3e Binary files /dev/null and b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/__pycache__/test_types.cpython-36.pyc differ diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/dbapi20.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/dbapi20.py new file mode 100644 index 00000000..93cdac66 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/dbapi20.py @@ -0,0 +1,841 @@ +#!/usr/bin/env python +''' Python DB API 2.0 driver compliance unit test suite. + + This software is Public Domain and may be used without restrictions. + + "Now we have booze and barflies entering the discussion, plus rumours of + DBAs on drugs... and I won't tell you what flashes through my mind each + time I read the subject line with 'Anal Compliance' in it. All around + this is turning out to be a thoroughly unwholesome unit test." + + -- Ian Bicking +''' + +__version__ = '1.14.3' + +import unittest +import time +import sys + +if sys.version[0] >= '3': #python 3.x + _BaseException = Exception + def _failUnless(self, expr, msg=None): + self.assertTrue(expr, msg) +else: #python 2.x + from exceptions import StandardError as _BaseException + def _failUnless(self, expr, msg=None): + self.failUnless(expr, msg) ## deprecated since Python 2.6 + +def str2bytes(sval): + if sys.version_info < (3,0) and isinstance(sval, str): + sval = sval.decode("latin1") + return sval.encode("latin1") #python 3 make unicode into bytes + +class DatabaseAPI20Test(unittest.TestCase): + ''' Test a database self.driver for DB API 2.0 compatibility. + This implementation tests Gadfly, but the TestCase + is structured so that other self.drivers can subclass this + test case to ensure compiliance with the DB-API. It is + expected that this TestCase may be expanded in the future + if ambiguities or edge conditions are discovered. + + The 'Optional Extensions' are not yet being tested. + + self.drivers should subclass this test, overriding setUp, tearDown, + self.driver, connect_args and connect_kw_args. Class specification + should be as follows: + + import dbapi20 + class mytest(dbapi20.DatabaseAPI20Test): + [...] + + Don't 'import DatabaseAPI20Test from dbapi20', or you will + confuse the unit tester - just 'import dbapi20'. + ''' + + # The self.driver module. This should be the module where the 'connect' + # method is to be found + driver = None + connect_args = () # List of arguments to pass to connect + connect_kw_args = {} # Keyword arguments for connect + table_prefix = 'dbapi20test_' # If you need to specify a prefix for tables + + ddl1 = 'create table %sbooze (name varchar(20))' % table_prefix + ddl2 = 'create table %sbarflys (name varchar(20), drink varchar(30))' % table_prefix + xddl1 = 'drop table %sbooze' % table_prefix + xddl2 = 'drop table %sbarflys' % table_prefix + insert = 'insert' + + lowerfunc = 'lower' # Name of stored procedure to convert string->lowercase + + # Some drivers may need to override these helpers, for example adding + # a 'commit' after the execute. + def executeDDL1(self,cursor): + cursor.execute(self.ddl1) + + def executeDDL2(self,cursor): + cursor.execute(self.ddl2) + + def setUp(self): + ''' self.drivers should override this method to perform required setup + if any is necessary, such as creating the database. + ''' + pass + + def tearDown(self): + ''' self.drivers should override this method to perform required cleanup + if any is necessary, such as deleting the test database. + The default drops the tables that may be created. + ''' + try: + con = self._connect() + try: + cur = con.cursor() + for ddl in (self.xddl1,self.xddl2): + try: + cur.execute(ddl) + con.commit() + except self.driver.Error: + # Assume table didn't exist. Other tests will check if + # execute is busted. + pass + finally: + con.close() + except _BaseException: + pass + + def _connect(self): + try: + r = self.driver.connect( + *self.connect_args,**self.connect_kw_args + ) + except AttributeError: + self.fail("No connect method found in self.driver module") + return r + + def test_connect(self): + con = self._connect() + con.close() + + def test_apilevel(self): + try: + # Must exist + apilevel = self.driver.apilevel + # Must equal 2.0 + self.assertEqual(apilevel,'2.0') + except AttributeError: + self.fail("Driver doesn't define apilevel") + + def test_threadsafety(self): + try: + # Must exist + threadsafety = self.driver.threadsafety + # Must be a valid value + _failUnless(self, threadsafety in (0,1,2,3)) + except AttributeError: + self.fail("Driver doesn't define threadsafety") + + def test_paramstyle(self): + try: + # Must exist + paramstyle = self.driver.paramstyle + # Must be a valid value + _failUnless(self, paramstyle in ( + 'qmark','numeric','named','format','pyformat' + )) + except AttributeError: + self.fail("Driver doesn't define paramstyle") + + def test_Exceptions(self): + # Make sure required exceptions exist, and are in the + # defined heirarchy. + if sys.version[0] == '3': #under Python 3 StardardError no longer exists + self.assertTrue(issubclass(self.driver.Warning,Exception)) + self.assertTrue(issubclass(self.driver.Error,Exception)) + else: + self.failUnless(issubclass(self.driver.Warning,StandardError)) + self.failUnless(issubclass(self.driver.Error,StandardError)) + + _failUnless(self, + issubclass(self.driver.InterfaceError,self.driver.Error) + ) + _failUnless(self, + issubclass(self.driver.DatabaseError,self.driver.Error) + ) + _failUnless(self, + issubclass(self.driver.OperationalError,self.driver.Error) + ) + _failUnless(self, + issubclass(self.driver.IntegrityError,self.driver.Error) + ) + _failUnless(self, + issubclass(self.driver.InternalError,self.driver.Error) + ) + _failUnless(self, + issubclass(self.driver.ProgrammingError,self.driver.Error) + ) + _failUnless(self, + issubclass(self.driver.NotSupportedError,self.driver.Error) + ) + + def test_ExceptionsAsConnectionAttributes(self): + # OPTIONAL EXTENSION + # Test for the optional DB API 2.0 extension, where the exceptions + # are exposed as attributes on the Connection object + # I figure this optional extension will be implemented by any + # driver author who is using this test suite, so it is enabled + # by default. + con = self._connect() + drv = self.driver + _failUnless(self,con.Warning is drv.Warning) + _failUnless(self,con.Error is drv.Error) + _failUnless(self,con.InterfaceError is drv.InterfaceError) + _failUnless(self,con.DatabaseError is drv.DatabaseError) + _failUnless(self,con.OperationalError is drv.OperationalError) + _failUnless(self,con.IntegrityError is drv.IntegrityError) + _failUnless(self,con.InternalError is drv.InternalError) + _failUnless(self,con.ProgrammingError is drv.ProgrammingError) + _failUnless(self,con.NotSupportedError is drv.NotSupportedError) + + + def test_commit(self): + con = self._connect() + try: + # Commit must work, even if it doesn't do anything + con.commit() + finally: + con.close() + + def test_rollback(self): + con = self._connect() + # If rollback is defined, it should either work or throw + # the documented exception + if hasattr(con,'rollback'): + try: + con.rollback() + except self.driver.NotSupportedError: + pass + + def test_cursor(self): + con = self._connect() + try: + cur = con.cursor() + finally: + con.close() + + def test_cursor_isolation(self): + con = self._connect() + try: + # Make sure cursors created from the same connection have + # the documented transaction isolation level + cur1 = con.cursor() + cur2 = con.cursor() + self.executeDDL1(cur1) + cur1.execute("%s into %sbooze values ('Victoria Bitter')" % ( + self.insert, self.table_prefix + )) + cur2.execute("select name from %sbooze" % self.table_prefix) + booze = cur2.fetchall() + self.assertEqual(len(booze),1) + self.assertEqual(len(booze[0]),1) + self.assertEqual(booze[0][0],'Victoria Bitter') + finally: + con.close() + + def test_description(self): + con = self._connect() + try: + cur = con.cursor() + self.executeDDL1(cur) + self.assertEqual(cur.description,None, + 'cursor.description should be none after executing a ' + 'statement that can return no rows (such as DDL)' + ) + cur.execute('select name from %sbooze' % self.table_prefix) + self.assertEqual(len(cur.description),1, + 'cursor.description describes too many columns' + ) + self.assertEqual(len(cur.description[0]),7, + 'cursor.description[x] tuples must have 7 elements' + ) + self.assertEqual(cur.description[0][0].lower(),'name', + 'cursor.description[x][0] must return column name' + ) + self.assertEqual(cur.description[0][1],self.driver.STRING, + 'cursor.description[x][1] must return column type. Got %r' + % cur.description[0][1] + ) + + # Make sure self.description gets reset + self.executeDDL2(cur) + self.assertEqual(cur.description,None, + 'cursor.description not being set to None when executing ' + 'no-result statements (eg. DDL)' + ) + finally: + con.close() + + def test_rowcount(self): + con = self._connect() + try: + cur = con.cursor() + self.executeDDL1(cur) + _failUnless(self,cur.rowcount in (-1,0), # Bug #543885 + 'cursor.rowcount should be -1 or 0 after executing no-result ' + 'statements' + ) + cur.execute("%s into %sbooze values ('Victoria Bitter')" % ( + self.insert, self.table_prefix + )) + _failUnless(self,cur.rowcount in (-1,1), + 'cursor.rowcount should == number or rows inserted, or ' + 'set to -1 after executing an insert statement' + ) + cur.execute("select name from %sbooze" % self.table_prefix) + _failUnless(self,cur.rowcount in (-1,1), + 'cursor.rowcount should == number of rows returned, or ' + 'set to -1 after executing a select statement' + ) + self.executeDDL2(cur) + _failUnless(self,cur.rowcount in (-1,0), # Bug #543885 + 'cursor.rowcount should be -1 or 0 after executing no-result ' + 'statements' + ) + finally: + con.close() + + lower_func = 'lower' + def test_callproc(self): + con = self._connect() + try: + cur = con.cursor() + if self.lower_func and hasattr(cur,'callproc'): + r = cur.callproc(self.lower_func,('FOO',)) + self.assertEqual(len(r),1) + self.assertEqual(r[0],'FOO') + r = cur.fetchall() + self.assertEqual(len(r),1,'callproc produced no result set') + self.assertEqual(len(r[0]),1, + 'callproc produced invalid result set' + ) + self.assertEqual(r[0][0],'foo', + 'callproc produced invalid results' + ) + finally: + con.close() + + def test_close(self): + con = self._connect() + try: + cur = con.cursor() + finally: + con.close() + + # cursor.execute should raise an Error if called after connection + # closed + self.assertRaises(self.driver.Error,self.executeDDL1,cur) + + # connection.commit should raise an Error if called after connection' + # closed.' + self.assertRaises(self.driver.Error,con.commit) + + def test_non_idempotent_close(self): + con = self._connect() + con.close() + # connection.close should raise an Error if called more than once + #!!! reasonable persons differ about the usefulness of this test and this feature !!! + self.assertRaises(self.driver.Error,con.close) + + def test_execute(self): + con = self._connect() + try: + cur = con.cursor() + self._paraminsert(cur) + finally: + con.close() + + def _paraminsert(self,cur): + self.executeDDL2(cur) + cur.execute("%s into %sbarflys values ('Victoria Bitter', 'thi%%s :may ca%%(u)se? troub:1e')" % ( + self.insert, self.table_prefix + )) + _failUnless(self,cur.rowcount in (-1,1)) + + if self.driver.paramstyle == 'qmark': + cur.execute( + "%s into %sbarflys values (?, 'thi%%s :may ca%%(u)se? troub:1e')" % (self.insert, self.table_prefix), + ("Cooper's",) + ) + elif self.driver.paramstyle == 'numeric': + cur.execute( + "%s into %sbarflys values (:1, 'thi%%s :may ca%%(u)se? troub:1e')" % (self.insert, self.table_prefix), + ("Cooper's",) + ) + elif self.driver.paramstyle == 'named': + cur.execute( + "%s into %sbarflys values (:beer, 'thi%%s :may ca%%(u)se? troub:1e')" % (self.insert, self.table_prefix), + {'beer':"Cooper's"} + ) + elif self.driver.paramstyle == 'format': + cur.execute( + "%s into %sbarflys values (%%s, 'thi%%%%s :may ca%%%%(u)se? troub:1e')" % (self.insert, self.table_prefix), + ("Cooper's",) + ) + elif self.driver.paramstyle == 'pyformat': + cur.execute( + "%s into %sbarflys values (%%(beer)s, 'thi%%%%s :may ca%%%%(u)se? troub:1e')" % (self.insert, self.table_prefix), + {'beer':"Cooper's"} + ) + else: + self.fail('Invalid paramstyle') + _failUnless(self,cur.rowcount in (-1,1)) + + cur.execute('select name, drink from %sbarflys' % self.table_prefix) + res = cur.fetchall() + self.assertEqual(len(res),2,'cursor.fetchall returned too few rows') + beers = [res[0][0],res[1][0]] + beers.sort() + self.assertEqual(beers[0],"Cooper's", + 'cursor.fetchall retrieved incorrect data, or data inserted ' + 'incorrectly' + ) + self.assertEqual(beers[1],"Victoria Bitter", + 'cursor.fetchall retrieved incorrect data, or data inserted ' + 'incorrectly' + ) + trouble = "thi%s :may ca%(u)se? troub:1e" + self.assertEqual(res[0][1], trouble, + 'cursor.fetchall retrieved incorrect data, or data inserted ' + 'incorrectly. Got=%s, Expected=%s' % (repr(res[0][1]), repr(trouble))) + self.assertEqual(res[1][1], trouble, + 'cursor.fetchall retrieved incorrect data, or data inserted ' + 'incorrectly. Got=%s, Expected=%s' % (repr(res[1][1]), repr(trouble) + )) + + def test_executemany(self): + con = self._connect() + try: + cur = con.cursor() + self.executeDDL1(cur) + largs = [ ("Cooper's",) , ("Boag's",) ] + margs = [ {'beer': "Cooper's"}, {'beer': "Boag's"} ] + if self.driver.paramstyle == 'qmark': + cur.executemany( + '%s into %sbooze values (?)' % (self.insert, self.table_prefix), + largs + ) + elif self.driver.paramstyle == 'numeric': + cur.executemany( + '%s into %sbooze values (:1)' % (self.insert, self.table_prefix), + largs + ) + elif self.driver.paramstyle == 'named': + cur.executemany( + '%s into %sbooze values (:beer)' % (self.insert, self.table_prefix), + margs + ) + elif self.driver.paramstyle == 'format': + cur.executemany( + '%s into %sbooze values (%%s)' % (self.insert, self.table_prefix), + largs + ) + elif self.driver.paramstyle == 'pyformat': + cur.executemany( + '%s into %sbooze values (%%(beer)s)' % ( + self.insert, self.table_prefix + ), + margs + ) + else: + self.fail('Unknown paramstyle') + _failUnless(self,cur.rowcount in (-1,2), + 'insert using cursor.executemany set cursor.rowcount to ' + 'incorrect value %r' % cur.rowcount + ) + cur.execute('select name from %sbooze' % self.table_prefix) + res = cur.fetchall() + self.assertEqual(len(res),2, + 'cursor.fetchall retrieved incorrect number of rows' + ) + beers = [res[0][0],res[1][0]] + beers.sort() + self.assertEqual(beers[0],"Boag's",'incorrect data retrieved') + self.assertEqual(beers[1],"Cooper's",'incorrect data retrieved') + finally: + con.close() + + def test_fetchone(self): + con = self._connect() + try: + cur = con.cursor() + + # cursor.fetchone should raise an Error if called before + # executing a select-type query + self.assertRaises(self.driver.Error,cur.fetchone) + + # cursor.fetchone should raise an Error if called after + # executing a query that cannnot return rows + self.executeDDL1(cur) + self.assertRaises(self.driver.Error,cur.fetchone) + + cur.execute('select name from %sbooze' % self.table_prefix) + self.assertEqual(cur.fetchone(),None, + 'cursor.fetchone should return None if a query retrieves ' + 'no rows' + ) + _failUnless(self,cur.rowcount in (-1,0)) + + # cursor.fetchone should raise an Error if called after + # executing a query that cannnot return rows + cur.execute("%s into %sbooze values ('Victoria Bitter')" % ( + self.insert, self.table_prefix + )) + self.assertRaises(self.driver.Error,cur.fetchone) + + cur.execute('select name from %sbooze' % self.table_prefix) + r = cur.fetchone() + self.assertEqual(len(r),1, + 'cursor.fetchone should have retrieved a single row' + ) + self.assertEqual(r[0],'Victoria Bitter', + 'cursor.fetchone retrieved incorrect data' + ) + self.assertEqual(cur.fetchone(),None, + 'cursor.fetchone should return None if no more rows available' + ) + _failUnless(self,cur.rowcount in (-1,1)) + finally: + con.close() + + samples = [ + 'Carlton Cold', + 'Carlton Draft', + 'Mountain Goat', + 'Redback', + 'Victoria Bitter', + 'XXXX' + ] + + def _populate(self): + ''' Return a list of sql commands to setup the DB for the fetch + tests. + ''' + populate = [ + "%s into %sbooze values ('%s')" % (self.insert, self.table_prefix, s) + for s in self.samples + ] + return populate + + def test_fetchmany(self): + con = self._connect() + try: + cur = con.cursor() + + # cursor.fetchmany should raise an Error if called without + #issuing a query + self.assertRaises(self.driver.Error,cur.fetchmany,4) + + self.executeDDL1(cur) + for sql in self._populate(): + cur.execute(sql) + + cur.execute('select name from %sbooze' % self.table_prefix) + r = cur.fetchmany() + self.assertEqual(len(r),1, + 'cursor.fetchmany retrieved incorrect number of rows, ' + 'default of arraysize is one.' + ) + cur.arraysize=10 + r = cur.fetchmany(3) # Should get 3 rows + self.assertEqual(len(r),3, + 'cursor.fetchmany retrieved incorrect number of rows' + ) + r = cur.fetchmany(4) # Should get 2 more + self.assertEqual(len(r),2, + 'cursor.fetchmany retrieved incorrect number of rows' + ) + r = cur.fetchmany(4) # Should be an empty sequence + self.assertEqual(len(r),0, + 'cursor.fetchmany should return an empty sequence after ' + 'results are exhausted' + ) + _failUnless(self,cur.rowcount in (-1,6)) + + # Same as above, using cursor.arraysize + cur.arraysize=4 + cur.execute('select name from %sbooze' % self.table_prefix) + r = cur.fetchmany() # Should get 4 rows + self.assertEqual(len(r),4, + 'cursor.arraysize not being honoured by fetchmany' + ) + r = cur.fetchmany() # Should get 2 more + self.assertEqual(len(r),2) + r = cur.fetchmany() # Should be an empty sequence + self.assertEqual(len(r),0) + _failUnless(self,cur.rowcount in (-1,6)) + + cur.arraysize=6 + cur.execute('select name from %sbooze' % self.table_prefix) + rows = cur.fetchmany() # Should get all rows + _failUnless(self,cur.rowcount in (-1,6)) + self.assertEqual(len(rows),6) + self.assertEqual(len(rows),6) + rows = [r[0] for r in rows] + rows.sort() + + # Make sure we get the right data back out + for i in range(0,6): + self.assertEqual(rows[i],self.samples[i], + 'incorrect data retrieved by cursor.fetchmany' + ) + + rows = cur.fetchmany() # Should return an empty list + self.assertEqual(len(rows),0, + 'cursor.fetchmany should return an empty sequence if ' + 'called after the whole result set has been fetched' + ) + _failUnless(self,cur.rowcount in (-1,6)) + + self.executeDDL2(cur) + cur.execute('select name from %sbarflys' % self.table_prefix) + r = cur.fetchmany() # Should get empty sequence + self.assertEqual(len(r),0, + 'cursor.fetchmany should return an empty sequence if ' + 'query retrieved no rows' + ) + _failUnless(self,cur.rowcount in (-1,0)) + + finally: + con.close() + + def test_fetchall(self): + con = self._connect() + try: + cur = con.cursor() + # cursor.fetchall should raise an Error if called + # without executing a query that may return rows (such + # as a select) + self.assertRaises(self.driver.Error, cur.fetchall) + + self.executeDDL1(cur) + for sql in self._populate(): + cur.execute(sql) + + # cursor.fetchall should raise an Error if called + # after executing a a statement that cannot return rows + self.assertRaises(self.driver.Error,cur.fetchall) + + cur.execute('select name from %sbooze' % self.table_prefix) + rows = cur.fetchall() + _failUnless(self,cur.rowcount in (-1,len(self.samples))) + self.assertEqual(len(rows),len(self.samples), + 'cursor.fetchall did not retrieve all rows' + ) + rows = [r[0] for r in rows] + rows.sort() + for i in range(0,len(self.samples)): + self.assertEqual(rows[i],self.samples[i], + 'cursor.fetchall retrieved incorrect rows' + ) + rows = cur.fetchall() + self.assertEqual( + len(rows),0, + 'cursor.fetchall should return an empty list if called ' + 'after the whole result set has been fetched' + ) + _failUnless(self,cur.rowcount in (-1,len(self.samples))) + + self.executeDDL2(cur) + cur.execute('select name from %sbarflys' % self.table_prefix) + rows = cur.fetchall() + _failUnless(self,cur.rowcount in (-1,0)) + self.assertEqual(len(rows),0, + 'cursor.fetchall should return an empty list if ' + 'a select query returns no rows' + ) + + finally: + con.close() + + def test_mixedfetch(self): + con = self._connect() + try: + cur = con.cursor() + self.executeDDL1(cur) + for sql in self._populate(): + cur.execute(sql) + + cur.execute('select name from %sbooze' % self.table_prefix) + rows1 = cur.fetchone() + rows23 = cur.fetchmany(2) + rows4 = cur.fetchone() + rows56 = cur.fetchall() + _failUnless(self,cur.rowcount in (-1,6)) + self.assertEqual(len(rows23),2, + 'fetchmany returned incorrect number of rows' + ) + self.assertEqual(len(rows56),2, + 'fetchall returned incorrect number of rows' + ) + + rows = [rows1[0]] + rows.extend([rows23[0][0],rows23[1][0]]) + rows.append(rows4[0]) + rows.extend([rows56[0][0],rows56[1][0]]) + rows.sort() + for i in range(0,len(self.samples)): + self.assertEqual(rows[i],self.samples[i], + 'incorrect data retrieved or inserted' + ) + finally: + con.close() + + def help_nextset_setUp(self,cur): + ''' Should create a procedure called deleteme + that returns two result sets, first the + number of rows in booze then "name from booze" + ''' + raise NotImplementedError('Helper not implemented') + #sql=""" + # create procedure deleteme as + # begin + # select count(*) from booze + # select name from booze + # end + #""" + #cur.execute(sql) + + def help_nextset_tearDown(self,cur): + 'If cleaning up is needed after nextSetTest' + raise NotImplementedError('Helper not implemented') + #cur.execute("drop procedure deleteme") + + def test_nextset(self): + con = self._connect() + try: + cur = con.cursor() + if not hasattr(cur,'nextset'): + return + + try: + self.executeDDL1(cur) + sql=self._populate() + for sql in self._populate(): + cur.execute(sql) + + self.help_nextset_setUp(cur) + + cur.callproc('deleteme') + numberofrows=cur.fetchone() + assert numberofrows[0]== len(self.samples) + assert cur.nextset() + names=cur.fetchall() + assert len(names) == len(self.samples) + s=cur.nextset() + assert s == None,'No more return sets, should return None' + finally: + self.help_nextset_tearDown(cur) + + finally: + con.close() + + def test_nextset(self): + raise NotImplementedError('Drivers need to override this test') + + def test_arraysize(self): + # Not much here - rest of the tests for this are in test_fetchmany + con = self._connect() + try: + cur = con.cursor() + _failUnless(self,hasattr(cur,'arraysize'), + 'cursor.arraysize must be defined' + ) + finally: + con.close() + + def test_setinputsizes(self): + con = self._connect() + try: + cur = con.cursor() + cur.setinputsizes( (25,) ) + self._paraminsert(cur) # Make sure cursor still works + finally: + con.close() + + def test_setoutputsize_basic(self): + # Basic test is to make sure setoutputsize doesn't blow up + con = self._connect() + try: + cur = con.cursor() + cur.setoutputsize(1000) + cur.setoutputsize(2000,0) + self._paraminsert(cur) # Make sure the cursor still works + finally: + con.close() + + def test_setoutputsize(self): + # Real test for setoutputsize is driver dependant + raise NotImplementedError('Driver needed to override this test') + + def test_None(self): + con = self._connect() + try: + cur = con.cursor() + self.executeDDL1(cur) + cur.execute("%s into %sbarflys values ('a', NULL)" % (self.insert, self.table_prefix)) + cur.execute('select drink from %sbarflys' % self.table_prefix) + r = cur.fetchall() + self.assertEqual(len(r),1) + self.assertEqual(len(r[0]),1) + self.assertEqual(r[0][0],None,'NULL value not returned as None') + finally: + con.close() + + def test_Date(self): + d1 = self.driver.Date(2002,12,25) + d2 = self.driver.DateFromTicks(time.mktime((2002,12,25,0,0,0,0,0,0))) + # Can we assume this? API doesn't specify, but it seems implied + # self.assertEqual(str(d1),str(d2)) + + def test_Time(self): + t1 = self.driver.Time(13,45,30) + t2 = self.driver.TimeFromTicks(time.mktime((2001,1,1,13,45,30,0,0,0))) + # Can we assume this? API doesn't specify, but it seems implied + # self.assertEqual(str(t1),str(t2)) + + def test_Timestamp(self): + t1 = self.driver.Timestamp(2002,12,25,13,45,30) + t2 = self.driver.TimestampFromTicks( + time.mktime((2002,12,25,13,45,30,0,0,0)) + ) + # Can we assume this? API doesn't specify, but it seems implied + # self.assertEqual(str(t1),str(t2)) + + def test_Binary(self): + b = self.driver.Binary(str2bytes('Something')) + b = self.driver.Binary(str2bytes('')) + + def test_STRING(self): + _failUnless(self, hasattr(self.driver,'STRING'), + 'module.STRING must be defined' + ) + + def test_BINARY(self): + _failUnless(self, hasattr(self.driver,'BINARY'), + 'module.BINARY must be defined.' + ) + + def test_NUMBER(self): + _failUnless(self, hasattr(self.driver,'NUMBER'), + 'module.NUMBER must be defined.' + ) + + def test_DATETIME(self): + _failUnless(self, hasattr(self.driver,'DATETIME'), + 'module.DATETIME must be defined.' + ) + + def test_ROWID(self): + _failUnless(self, hasattr(self.driver,'ROWID'), + 'module.ROWID must be defined.' + ) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_avatica.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_avatica.py new file mode 100644 index 00000000..ed0f05e9 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_avatica.py @@ -0,0 +1,10 @@ +import unittest +from phoenixdb.avatica import parse_url, urlparse + + +class ParseUrlTest(unittest.TestCase): + + def test_parse_url(self): + self.assertEqual(urlparse.urlparse('http://localhost:8765/'), parse_url('localhost')) + self.assertEqual(urlparse.urlparse('http://localhost:2222/'), parse_url('localhost:2222')) + self.assertEqual(urlparse.urlparse('http://localhost:2222/'), parse_url('http://localhost:2222/')) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_connection.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_connection.py new file mode 100644 index 00000000..6c935ae5 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_connection.py @@ -0,0 +1,29 @@ +import unittest +import phoenixdb +from . import dbapi20 +from phoenixdb.tests import TEST_DB_URL + +@unittest.skipIf(TEST_DB_URL is None, "these tests require the PHOENIXDB_TEST_DB_URL environment variable set to a clean database") +class PhoenixConnectionTest(unittest.TestCase): + + def _connect(self, connect_kw_args): + try: + r = phoenixdb.connect( + *(TEST_DB_URL, ), **connect_kw_args + ) + except AttributeError: + self.fail("Failed to connect") + return r + + def test_connection_credentials(self): + connect_kw_args = {'user':'SCOTT', 'password':'TIGER', 'readonly':'True'} + con = self._connect(connect_kw_args) + try: + self.assertEqual(con._connection_args, {'user':'SCOTT', 'password':'TIGER'}, + 'Should have extract user and password' + ) + self.assertEqual(con._filtered_args, {'readonly':'True'}, + 'Should have not extracted foo' + ) + finally: + con.close() diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_db.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_db.py new file mode 100644 index 00000000..f408a40e --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_db.py @@ -0,0 +1,65 @@ +import unittest +import phoenixdb +import phoenixdb.cursor +from phoenixdb.tests import TEST_DB_URL + + +@unittest.skipIf(TEST_DB_URL is None, "these tests require the PHOENIXDB_TEST_DB_URL environment variable set to a clean database") +class PhoenixDatabaseTest(unittest.TestCase): + + def test_select_literal(self): + db = phoenixdb.connect(TEST_DB_URL, autocommit=True) + self.addCleanup(db.close) + + with db.cursor() as cursor: + cursor.execute("DROP TABLE IF EXISTS test") + cursor.execute("CREATE TABLE test (id INTEGER PRIMARY KEY, text VARCHAR)") + cursor.executemany("UPSERT INTO test VALUES (?, ?)", [[i, 'text {}'.format(i)] for i in range(10)]) + + with db.cursor() as cursor: + cursor.itersize = 4 + cursor.execute("SELECT * FROM test WHERE id>1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[i, 'text {}'.format(i)] for i in range(2, 10)]) + + def test_select_parameter(self): + db = phoenixdb.connect(TEST_DB_URL, autocommit=True) + self.addCleanup(db.close) + + with db.cursor() as cursor: + cursor.execute("DROP TABLE IF EXISTS test") + cursor.execute("CREATE TABLE test (id INTEGER PRIMARY KEY, text VARCHAR)") + cursor.executemany("UPSERT INTO test VALUES (?, ?)", [[i, 'text {}'.format(i)] for i in range(10)]) + + with db.cursor() as cursor: + cursor.itersize = 4 + cursor.execute("SELECT * FROM test WHERE id>? ORDER BY id", [1]) + self.assertEqual(cursor.fetchall(), [[i, 'text {}'.format(i)] for i in range(2, 10)]) + + def _check_dict_cursor(self, cursor): + cursor.execute("DROP TABLE IF EXISTS test") + cursor.execute("CREATE TABLE test (id INTEGER PRIMARY KEY, text VARCHAR)") + cursor.execute("UPSERT INTO test VALUES (?, ?)", [1, 'text 1']) + cursor.execute("SELECT * FROM test ORDER BY id") + self.assertEqual(cursor.fetchall(), [{'ID': 1, 'TEXT': 'text 1'}]) + + def test_dict_cursor_default_parameter(self): + db = phoenixdb.connect(TEST_DB_URL, autocommit=True, cursor_factory=phoenixdb.cursor.DictCursor) + self.addCleanup(db.close) + + with db.cursor() as cursor: + self._check_dict_cursor(cursor) + + def test_dict_cursor_default_attribute(self): + db = phoenixdb.connect(TEST_DB_URL, autocommit=True) + db.cursor_factory = phoenixdb.cursor.DictCursor + self.addCleanup(db.close) + + with db.cursor() as cursor: + self._check_dict_cursor(cursor) + + def test_dict_cursor(self): + db = phoenixdb.connect(TEST_DB_URL, autocommit=True) + self.addCleanup(db.close) + + with db.cursor(cursor_factory=phoenixdb.cursor.DictCursor) as cursor: + self._check_dict_cursor(cursor) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_dbapi20.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_dbapi20.py new file mode 100644 index 00000000..e6622003 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_dbapi20.py @@ -0,0 +1,108 @@ +import unittest +import phoenixdb +from . import dbapi20 +from phoenixdb.tests import TEST_DB_URL + + +@unittest.skipIf(TEST_DB_URL is None, "these tests require the PHOENIXDB_TEST_DB_URL environment variable set to a clean database") +class PhoenixDatabaseAPI20Test(dbapi20.DatabaseAPI20Test): + driver = phoenixdb + connect_args = (TEST_DB_URL, ) + + ddl1 = 'create table %sbooze (name varchar(20) primary key)' % dbapi20.DatabaseAPI20Test.table_prefix + ddl2 = 'create table %sbarflys (name varchar(20) primary key, drink varchar(30))' % dbapi20.DatabaseAPI20Test.table_prefix + insert = 'upsert' + + def test_nextset(self): pass + def test_setoutputsize(self): pass + + def _connect(self): + con = dbapi20.DatabaseAPI20Test._connect(self) + con.autocommit = True + return con + + def test_None(self): + con = self._connect() + try: + cur = con.cursor() + self.executeDDL2(cur) + cur.execute("%s into %sbarflys values ('a', NULL)" % (self.insert, self.table_prefix)) + cur.execute('select drink from %sbarflys' % self.table_prefix) + r = cur.fetchall() + self.assertEqual(len(r),1) + self.assertEqual(len(r[0]),1) + self.assertEqual(r[0][0],None,'NULL value not returned as None') + finally: + con.close() + + def test_autocommit(self): + con = dbapi20.DatabaseAPI20Test._connect(self) + self.assertFalse(con.autocommit) + con.autocommit = True + self.assertTrue(con.autocommit) + con.autocommit = False + self.assertFalse(con.autocommit) + con.close() + + def test_readonly(self): + con = dbapi20.DatabaseAPI20Test._connect(self) + self.assertFalse(con.readonly) + con.readonly = True + self.assertTrue(con.readonly) + con.readonly = False + self.assertFalse(con.readonly) + con.close() + + def test_iter(self): + # https://www.python.org/dev/peps/pep-0249/#iter + con = self._connect() + try: + cur = con.cursor() + if hasattr(cur,'__iter__'): + self.assertIs(cur,iter(cur)) + finally: + con.close() + + def test_next(self): + # https://www.python.org/dev/peps/pep-0249/#next + con = self._connect() + try: + cur = con.cursor() + if not hasattr(cur,'next'): + return + + # cursor.next should raise an Error if called before + # executing a select-type query + self.assertRaises(self.driver.Error,cur.next) + + # cursor.next should raise an Error if called after + # executing a query that cannnot return rows + self.executeDDL1(cur) + self.assertRaises(self.driver.Error,cur.next) + + # cursor.next should return None if a query retrieves ' + # no rows + cur.execute('select name from %sbooze' % self.table_prefix) + self.assertRaises(StopIteration,cur.next) + self.failUnless(cur.rowcount in (-1,0)) + + # cursor.next should raise an Error if called after + # executing a query that cannnot return rows + cur.execute("%s into %sbooze values ('Victoria Bitter')" % ( + self.insert, self.table_prefix + )) + self.assertRaises(self.driver.Error,cur.next) + + cur.execute('select name from %sbooze' % self.table_prefix) + r = cur.next() + self.assertEqual(len(r),1, + 'cursor.next should have retrieved a row with one column' + ) + self.assertEqual(r[0],'Victoria Bitter', + 'cursor.next retrieved incorrect data' + ) + # cursor.next should raise StopIteration if no more rows available + self.assertRaises(StopIteration,cur.next) + self.failUnless(cur.rowcount in (-1,1)) + finally: + con.close() diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_errors.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_errors.py new file mode 100644 index 00000000..3106ea5f --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_errors.py @@ -0,0 +1,45 @@ +from phoenixdb.tests import DatabaseTestCase + + +class ProgrammingErrorTest(DatabaseTestCase): + + def test_invalid_sql(self): + with self.conn.cursor() as cursor: + with self.assertRaises(self.conn.ProgrammingError) as cm: + cursor.execute("UPS") + self.assertEqual("Syntax error. Encountered \"UPS\" at line 1, column 1.", cm.exception.message) + self.assertEqual(601, cm.exception.code) + self.assertEqual("42P00", cm.exception.sqlstate) + + +class IntegrityErrorTest(DatabaseTestCase): + + def test_null_in_pk(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key") + with self.conn.cursor() as cursor: + with self.assertRaises(self.conn.IntegrityError) as cm: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (NULL)") + self.assertEqual("Constraint violation. PHOENIXDB_TEST_TBL1.ID may not be null", cm.exception.message) + self.assertEqual(218, cm.exception.code) + self.assertIn(cm.exception.sqlstate, ("22018", "23018")) + + +class DataErrorTest(DatabaseTestCase): + + def test_number_outside_of_range(self): + self.createTable("phoenixdb_test_tbl1", "id tinyint primary key") + with self.conn.cursor() as cursor: + with self.assertRaises(self.conn.DataError) as cm: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (10000)") + self.assertEqual("Type mismatch. TINYINT and INTEGER for 10000", cm.exception.message) + self.assertEqual(203, cm.exception.code) + self.assertEqual("22005", cm.exception.sqlstate) + + def test_division_by_zero(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key") + with self.conn.cursor() as cursor: + with self.assertRaises(self.conn.DataError) as cm: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2/0)") + self.assertEqual("Divide by zero.", cm.exception.message) + self.assertEqual(202, cm.exception.code) + self.assertEqual("22012", cm.exception.sqlstate) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_types.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_types.py new file mode 100644 index 00000000..96019fa1 --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/tests/test_types.py @@ -0,0 +1,302 @@ +import sys +import unittest +import datetime +import phoenixdb +from decimal import Decimal +from phoenixdb.tests import DatabaseTestCase + + +class TypesTest(DatabaseTestCase): + + def checkIntType(self, type_name, min_value, max_value): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val {}".format(type_name)) + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 1)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [1]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [None]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, ?)", [min_value]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)", [max_value]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.description[1].type_code, phoenixdb.NUMBER) + self.assertEqual(cursor.fetchall(), [[1, 1], [2, None], [3, 1], [4, None], [5, min_value], [6, max_value]]) + + self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, {})".format(min_value - 1)) + self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, {})".format(max_value + 1)) + # XXX The server silently truncates the values + #self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [min_value - 1]) + #self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [max_value + 1]) + + def test_integer(self): + self.checkIntType("integer", -2147483648, 2147483647) + + def test_unsigned_int(self): + self.checkIntType("unsigned_int", 0, 2147483647) + + def test_bigint(self): + self.checkIntType("bigint", -9223372036854775808, 9223372036854775807) + + def test_unsigned_long(self): + self.checkIntType("unsigned_long", 0, 9223372036854775807) + + def test_tinyint(self): + self.checkIntType("tinyint", -128, 127) + + def test_unsigned_tinyint(self): + self.checkIntType("unsigned_tinyint", 0, 127) + + def test_smallint(self): + self.checkIntType("smallint", -32768, 32767) + + def test_unsigned_smallint(self): + self.checkIntType("unsigned_smallint", 0, 32767) + + def checkFloatType(self, type_name, min_value, max_value): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val {}".format(type_name)) + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 1)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [1]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [None]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, ?)", [min_value]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)", [max_value]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.description[1].type_code, phoenixdb.NUMBER) + rows = cursor.fetchall() + self.assertEqual([r[0] for r in rows], [1, 2, 3, 4, 5, 6]) + self.assertEqual(rows[0][1], 1.0) + self.assertEqual(rows[1][1], None) + self.assertEqual(rows[2][1], 1.0) + self.assertEqual(rows[3][1], None) + self.assertAlmostEqual(rows[4][1], min_value) + self.assertAlmostEqual(rows[5][1], max_value) + + def test_float(self): + self.checkFloatType("float", -3.4028234663852886e+38, 3.4028234663852886e+38) + + def test_unsigned_float(self): + self.checkFloatType("unsigned_float", 0, 3.4028234663852886e+38) + + def test_double(self): + self.checkFloatType("double", -1.7976931348623158E+308, 1.7976931348623158E+308) + + def test_unsigned_double(self): + self.checkFloatType("unsigned_double", 0, 1.7976931348623158E+308) + + def test_decimal(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val decimal(8,3)") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 33333.333)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [33333.333]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [Decimal('33333.333')]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, ?)", [None]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.description[1].type_code, phoenixdb.NUMBER) + rows = cursor.fetchall() + self.assertEqual([r[0] for r in rows], [1, 2, 3, 4, 5]) + self.assertEqual(rows[0][1], Decimal('33333.333')) + self.assertEqual(rows[1][1], None) + self.assertEqual(rows[2][1], Decimal('33333.333')) + self.assertEqual(rows[3][1], Decimal('33333.333')) + self.assertEqual(rows[4][1], None) + self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [Decimal('1234567890')]) + self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (101, ?)", [Decimal('123456.789')]) + + def test_boolean(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val boolean") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, TRUE)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, FALSE)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [True]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, ?)", [False]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)", [None]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.description[1].type_code, phoenixdb.BOOLEAN) + self.assertEqual(cursor.fetchall(), [[1, True], [2, False], [3, None], [4, True], [5, False], [6, None]]) + + def test_time(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val time") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '1970-01-01 12:01:02')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [phoenixdb.Time(12, 1, 2)]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [datetime.time(12, 1, 2)]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, ?)", [None]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, datetime.time(12, 1, 2)], + [2, None], + [3, datetime.time(12, 1, 2)], + [4, datetime.time(12, 1, 2)], + [5, None], + ]) + + @unittest.skip("https://issues.apache.org/jira/browse/CALCITE-797") + def test_time_full(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val time") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 13:01:02.123')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", [datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)], + [2, datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)], + ]) + + def test_date(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val date") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 00:00:00')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [phoenixdb.Date(2015, 7, 12)]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [datetime.date(2015, 7, 12)]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, datetime.date(2015, 7, 12)], + [3, datetime.date(2015, 7, 12)], + [4, datetime.date(2015, 7, 12)], + ]) + + @unittest.skip("https://issues.apache.org/jira/browse/CALCITE-798") + def test_date_full(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val date") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 13:01:02.123')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", [datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)], + [2, datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)], + ]) + + def test_date_null(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val date") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", [None]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") # raises NullPointerException on the server + self.assertEqual(cursor.fetchall(), [ + [1, None], + [2, None], + ]) + + def test_timestamp(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val timestamp") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 13:01:02.123')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [phoenixdb.Timestamp(2015, 7, 12, 13, 1, 2)]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, ?)", [None]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)], + [2, None], + [3, datetime.datetime(2015, 7, 12, 13, 1, 2)], + [4, datetime.datetime(2015, 7, 12, 13, 1, 2, 123000)], + [5, None], + ]) + + @unittest.skip("https://issues.apache.org/jira/browse/CALCITE-796") + def test_timestamp_full(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val timestamp") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 13:01:02.123456789')") + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, datetime.datetime(2015, 7, 12, 13, 1, 2, 123456789)], + ]) + + def test_varchar(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val varchar") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 'abc')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", ['abc']) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [None]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, '')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)", ['']) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[1, 'abc'], [2, None], [3, 'abc'], [4, None], [5, None], [6, None]]) + + def test_varchar_very_long(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val varchar") + with self.conn.cursor() as cursor: + value = '1234567890' * 1000 + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, ?)", [value]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[1, value]]) + + def test_varchar_limited(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val varchar(2)") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 'ab')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", ['ab']) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [None]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, '')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)", ['']) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[1, 'ab'], [2, None], [3, 'ab'], [4, None], [5, None], [6, None]]) + self.assertRaises(self.conn.DataError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, 'abc')") + + def test_char_null(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val char(2)") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, NULL)") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [None]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (5, '')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)", ['']) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[2, None], [4, None], [5, None], [6, None]]) + self.assertRaises(self.conn.DataError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, 'abc')") + + def test_char(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val char(2)") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 'ab')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", ['ab']) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, 'a')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", ['b']) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[1, 'ab'], [2, 'ab'], [3, 'a'], [4, 'b']]) + self.assertRaises(self.conn.DataError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, 'abc')") + + def test_binary(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val binary(2)") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 'ab')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", [phoenixdb.Binary(b'ab')]) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, '\x01\x00')") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (4, ?)", [phoenixdb.Binary(b'\x01\x00')]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, b'ab'], + [2, b'ab'], + [3, b'\x01\x00'], + [4, b'\x01\x00'], + ]) + + def test_binary_all_bytes(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val binary(256)") + with self.conn.cursor() as cursor: + if sys.version_info[0] < 3: + value = ''.join(map(chr, range(256))) + else: + value = bytes(range(256)) + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, ?)", [phoenixdb.Binary(value)]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [[1, value]]) + + @unittest.skip("https://issues.apache.org/jira/browse/CALCITE-1050 https://issues.apache.org/jira/browse/PHOENIX-2585") + def test_array(self): + self.createTable("phoenixdb_test_tbl1", "id integer primary key, val integer[]") + with self.conn.cursor() as cursor: + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, ARRAY[1,2])") + cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", [[2,3]]) + cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id") + self.assertEqual(cursor.fetchall(), [ + [1, [1,2]], + [2, [2,3]], + ]) diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/types.py b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/types.py new file mode 100644 index 00000000..bb81408f --- /dev/null +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/code/phoenixdb/types.py @@ -0,0 +1,193 @@ +# Copyright 2015 Lukas Lalinsky +# +# 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. + +import sys +import time +import datetime +from decimal import Decimal +from phoenixdb.calcite import common_pb2 + +__all__ = [ + 'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 'TimestampFromTicks', + 'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN', + 'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper', +] + + +def Date(year, month, day): + """Constructs an object holding a date value.""" + return datetime.date(year, month, day) + + +def Time(hour, minute, second): + """Constructs an object holding a time value.""" + return datetime.time(hour, minute, second) + + +def Timestamp(year, month, day, hour, minute, second): + """Constructs an object holding a datetime/timestamp value.""" + return datetime.datetime(year, month, day, hour, minute, second) + + +def DateFromTicks(ticks): + """Constructs an object holding a date value from the given UNIX timestamp.""" + return Date(*time.localtime(ticks)[:3]) + + +def TimeFromTicks(ticks): + """Constructs an object holding a time value from the given UNIX timestamp.""" + return Time(*time.localtime(ticks)[3:6]) + + +def TimestampFromTicks(ticks): + """Constructs an object holding a datetime/timestamp value from the given UNIX timestamp.""" + return Timestamp(*time.localtime(ticks)[:6]) + + +def Binary(value): + """Constructs an object capable of holding a binary (long) string value.""" + return bytes(value) + + +def time_from_java_sql_time(n): + dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n) + return dt.time() + + +def time_to_java_sql_time(t): + return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond // 1000 + + +def date_from_java_sql_date(n): + return datetime.date(1970, 1, 1) + datetime.timedelta(days=n) + + +def date_to_java_sql_date(d): + if isinstance(d, datetime.datetime): + d = d.date() + td = d - datetime.date(1970, 1, 1) + return td.days + + +def datetime_from_java_sql_timestamp(n): + return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n) + + +def datetime_to_java_sql_timestamp(d): + td = d - datetime.datetime(1970, 1, 1) + return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000 + + +class ColumnType(object): + + def __init__(self, eq_types): + self.eq_types = tuple(eq_types) + self.eq_types_set = set(eq_types) + + def __eq__(self, other): + return other in self.eq_types_set + + def __cmp__(self, other): + if other in self.eq_types_set: + return 0 + if other < self.eq_types: + return 1 + else: + return -1 + + +STRING = ColumnType(['VARCHAR', 'CHAR']) +"""Type object that can be used to describe string-based columns.""" + +BINARY = ColumnType(['BINARY', 'VARBINARY']) +"""Type object that can be used to describe (long) binary columns.""" + +NUMBER = ColumnType(['INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 'UNSIGNED_TINYINT', 'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 'UNSIGNED_DOUBLE', 'DECIMAL']) +"""Type object that can be used to describe numeric columns.""" + +DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP']) +"""Type object that can be used to describe date/time columns.""" + +ROWID = ColumnType([]) +"""Only implemented for DB API 2.0 compatibility, not used.""" + +BOOLEAN = ColumnType(['BOOLEAN']) +"""Type object that can be used to describe boolean columns. This is a phoenixdb-specific extension.""" + + +# XXX ARRAY + +JAVA_CLASSES = { + 'bool_value': [ + ('java.lang.Boolean', common_pb2.BOOLEAN, None, None), + ], + 'string_value': [ + ('java.lang.Character', common_pb2.CHARACTER, None, None), + ('java.lang.String', common_pb2.STRING, None, None), + ('java.math.BigDecimal', common_pb2.BIG_DECIMAL, str, Decimal), + ], + 'number_value': [ + ('java.lang.Integer', common_pb2.INTEGER, None, int), + ('java.lang.Short', common_pb2.SHORT, None, int), + ('java.lang.Long', common_pb2.LONG, None, long if sys.version_info[0] < 3 else int), + ('java.lang.Byte', common_pb2.BYTE, None, int), + ('java.sql.Time', common_pb2.JAVA_SQL_TIME, time_to_java_sql_time, time_from_java_sql_time), + ('java.sql.Date', common_pb2.JAVA_SQL_DATE, date_to_java_sql_date, date_from_java_sql_date), + ('java.sql.Timestamp', common_pb2.JAVA_SQL_TIMESTAMP, datetime_to_java_sql_timestamp, datetime_from_java_sql_timestamp), + ], + 'bytes_value': [ + ('[B', common_pb2.BYTE_STRING, Binary, None), + ], + 'double_value': [ + # if common_pb2.FLOAT is used, incorrect values are sent + ('java.lang.Float', common_pb2.DOUBLE, float, float), + ('java.lang.Double', common_pb2.DOUBLE, float, float), + ] +} +"""Groups of Java classes.""" + +JAVA_CLASSES_MAP = dict( (v[0], (k, v[1], v[2], v[3])) for k in JAVA_CLASSES for v in JAVA_CLASSES[k] ) +"""Flips the available types to allow for faster lookup by Java class. + +This mapping should be structured as: + { + 'java.math.BigDecimal': ('string_value', common_pb2.BIG_DECIMAL, str, Decimal),), + ... + '': (, , , ), + } +""" + + +class TypeHelper(object): + @staticmethod + def from_class(klass): + """Retrieves a Rep and functions to cast to/from based on the Java class. + + :param klass: + The string of the Java class for the column or parameter. + + :returns: tuple ``(field_name, rep, mutate_to, cast_from)`` + WHERE + ``field_name`` is the attribute in ``common_pb2.TypedValue`` + ``rep`` is the common_pb2.Rep enum + ``mutate_to`` is the function to cast values into Phoenix values, if any + ``cast_from`` is the function to cast from the Phoenix value to the Python value, if any + + :raises: + NotImplementedError + """ + if klass not in JAVA_CLASSES_MAP: + raise NotImplementedError('type {} is not supported'.format(klass)) + + return JAVA_CLASSES_MAP[klass] diff --git a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/s.yaml b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/s.yaml index bcc90c51..d7b9adae 100644 --- a/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/s.yaml +++ b/quick-start-sample-codes/quick-start-sample-codes-python/fc-to-lindorm-sample/src/s.yaml @@ -7,18 +7,17 @@ access: "{{ access }}" services: FCToLindormSample: # 业务名称/模块名称 - component: fc # 组件名称,Serverless Devs 工具本身类似于一种游戏机,不具备具体的业务能力,组件类似于游戏卡,用户通过向游戏机中插入不同的游戏卡实现不同的功能,即通过使用不同的组件实现不同的具体业务能力 + component: fc # 组件名称,Serverless Devs 工具本身类似于一种游戏机,不具备具体的业务能力,组件类似于游戏卡,用户通过向游戏机中插入不同的游戏卡实现不同的功能,即通过使用不同的组件实现不同的具体业务能力 actions: pre-deploy: - run: s build --use-docker - path: ./ post-deploy: - component: fc ondemand put --qualifier LATEST --max 10 props: region: "{{ region }}" service: name: "{{ serviceName }}" - description: 'fc to lindorm quick start sample service' + description: "fc to lindorm quick start sample service" vpcConfig: vpcId: "{{ vpcID }}" securityGroupId: "{{ securityGroupID }}" @@ -26,7 +25,7 @@ services: - "{{ vswitchID }}" function: name: "{{ functionName }}" - description: 'fc to lindorm quick start sample function' + description: "fc to lindorm quick start sample function" runtime: python3 codeUri: ./code handler: index.handler @@ -38,4 +37,4 @@ services: LindormUserName: "{{ lindormUserName }}" LindormPassword: "{{ lindormPassword }}" DatabaseURL: "{{ databaseURL }}" - SQLTableName: "{{ sqlTableName }}" \ No newline at end of file + SQLTableName: "{{ sqlTableName }}"