You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Igor Sapego (Jira)" <ji...@apache.org> on 2024/07/12 09:56:00 UTC

[jira] [Created] (IGNITE-22719) Python DB API Driver 3.0

Igor Sapego created IGNITE-22719:
------------------------------------

             Summary: Python DB API Driver 3.0
                 Key: IGNITE-22719
                 URL: https://issues.apache.org/jira/browse/IGNITE-22719
             Project: Ignite
          Issue Type: Epic
          Components: platforms, python, thin client
            Reporter: Igor Sapego
            Assignee: Igor Sapego


h3. Requirements
* The implementation of the Python DB API or the Driver should be implemented using Python 3;
* The Driver should comply with Python DB-API 2.0: https://peps.python.org/pep-0249/;
* Performance of the Driver should be similar to the performance of other clients and drivers, e.g. JDBC;
* The first implementation should be as simple as possible, but it should be functional and allow for improvements in future;
* Preferably the Driver should be designed in such a way that makes it possible in the future to extend Driver’s API and turn it into a full-fledged Python Client.

h4. Code Reuse
It is proposed to re-use the protocol part, which is currently used by ODBC and JDBC drivers. Its functionality should be more than enough for implementation of the Driver, as the DB API is much simpler than both JDBC and ODBC.
It is also proposed to re-use C++ code for data packing-unpacking (protocol messages, binary tuples).
It’s important to point out that in most of the implementations of such drivers, C/C++ code is duplicated in Python, but the first implementation of our Driver won’t include duplication of C++ code for the sake of simplicity. This means, if the user won’t be able to compile our C++ code on their platform for any reason, they won’t be able to use our Driver.

h4. Type Mapping
The implementation of the specification is pretty straightforward and there is no need to discuss implementation of methods in detail. The only part that should probably be discussed is a data type mapping.

The following type mapping is suggested for the Driver:

||Ignite Type||DB API Type||Python Type||
|NIL|None|None|
|BOOLEAN|NUMBER|bool|
|INT8|NUMBER|int|
|INT16|NUMBER|int|
|INT32|NUMBER|int|
|INT64|NUMBER|int|
|FLOAT|NUMBER|float|
|DOUBLE|NUMBER|float|
|DECIMAL|NUMBER|decimal.Decimal|
|DATE|DATETIME|datetime.date|
|TIME|DATETIME|datetime.time|
|DATETIME|DATETIME|datetime.datetime|
|TIMESTAMP|NUMBER|datetime.datetime|
|UUID|STRING|uuid.UUID|
|BITMASK|NUMBER|int|
|STRING|STRING|str|
|BYTE_ARRAY|BINARY|bytes|
|PERIOD|DATETIME|datetime.timedelta|
|DURATION|DATETIME|datetime.timedelta|
|NUMBER|NUMBER|decimal.Decimal|





--
This message was sent by Atlassian Jira
(v8.20.10#820010)