crate 2.0.0.dev3__tar.gz → 2.0.0.dev5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/CHANGES.rst +11 -1
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/PKG-INFO +1 -1
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/__init__.py +1 -1
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/http.py +18 -7
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate.egg-info/PKG-INFO +1 -1
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/CONTRIBUTING.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/DEVELOP.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/LICENSE +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/MANIFEST.in +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/NOTICE +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/README.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/_extra/robots.txt +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/backlog.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/blobs.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/blob.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/client.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/connection.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/cursor.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/http.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/https.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/by-example/index.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/conf.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/connect.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/data-types.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/docutils.conf +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/getting-started.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/index-all.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/index.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/other-options.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/query.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/requirements.txt +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/docs/sqlalchemy.rst +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/pyproject.toml +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/requirements.txt +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/setup.cfg +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/setup.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/_pep440.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/blob.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/connection.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/converter.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/cursor.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/client/exceptions.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/testing/__init__.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/testing/layer.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate/testing/util.py +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate.egg-info/SOURCES.txt +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate.egg-info/dependency_links.txt +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate.egg-info/requires.txt +0 -0
- {crate-2.0.0.dev3 → crate-2.0.0.dev5}/src/crate.egg-info/top_level.txt +0 -0
@@ -5,7 +5,17 @@ Changes for crate
|
|
5
5
|
Unreleased
|
6
6
|
==========
|
7
7
|
|
8
|
-
-
|
8
|
+
- Switched JSON encoder to use the `orjson`_ library, to improve JSON
|
9
|
+
marshalling performance. Thanks, @widmogrod.
|
10
|
+
orjson is fast and in some spots even more correct when compared against
|
11
|
+
Python's stdlib ``json`` module. Contrary to the stdlib variant, orjson
|
12
|
+
will serialize to ``bytes`` instead of ``str``. Please also note it
|
13
|
+
will not deserialize to dataclasses, UUIDs, decimals, etc., or support
|
14
|
+
``object_hook``. Within ``crate-python``, it is applied with an encoder
|
15
|
+
function for additional type support about Python's ``Decimal`` type and
|
16
|
+
freezegun's ``FakeDatetime`` type.
|
17
|
+
|
18
|
+
.. _orjson: https://github.com/ijl/orjson
|
9
19
|
|
10
20
|
2024/11/23 1.0.1
|
11
21
|
================
|
@@ -28,6 +28,7 @@ import re
|
|
28
28
|
import socket
|
29
29
|
import ssl
|
30
30
|
import threading
|
31
|
+
import typing as t
|
31
32
|
from base64 import b64encode
|
32
33
|
from decimal import Decimal
|
33
34
|
from time import time
|
@@ -83,22 +84,32 @@ def super_len(o):
|
|
83
84
|
return None
|
84
85
|
|
85
86
|
|
86
|
-
def cratedb_json_encoder(obj):
|
87
|
+
def cratedb_json_encoder(obj: t.Any) -> str:
|
87
88
|
"""
|
88
|
-
Encoder function for orjson.
|
89
|
+
Encoder function for orjson, with additional type support.
|
90
|
+
|
91
|
+
- Python's `Decimal` type.
|
92
|
+
- freezegun's `FakeDatetime` type.
|
89
93
|
|
90
94
|
https://github.com/ijl/orjson#default
|
91
95
|
"""
|
92
|
-
if isinstance(obj,
|
96
|
+
if isinstance(obj, Decimal):
|
93
97
|
return str(obj)
|
94
|
-
|
98
|
+
elif hasattr(obj, "isoformat"):
|
99
|
+
return obj.isoformat()
|
100
|
+
raise TypeError
|
101
|
+
|
95
102
|
|
103
|
+
def json_dumps(obj: t.Any) -> bytes:
|
104
|
+
"""
|
105
|
+
Serialize to JSON format, using `orjson`, with additional type support.
|
96
106
|
|
97
|
-
|
107
|
+
https://github.com/ijl/orjson
|
108
|
+
"""
|
98
109
|
return orjson.dumps(
|
99
110
|
obj,
|
100
111
|
default=cratedb_json_encoder,
|
101
|
-
option=orjson.OPT_SERIALIZE_NUMPY,
|
112
|
+
option=(orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY),
|
102
113
|
)
|
103
114
|
|
104
115
|
|
@@ -318,7 +329,7 @@ def _update_pool_kwargs_for_ssl_minimum_version(server, kwargs):
|
|
318
329
|
kwargs["ssl_minimum_version"] = ssl.TLSVersion.MINIMUM_SUPPORTED
|
319
330
|
|
320
331
|
|
321
|
-
def _create_sql_payload(stmt, args, bulk_args):
|
332
|
+
def _create_sql_payload(stmt, args, bulk_args) -> bytes:
|
322
333
|
if not isinstance(stmt, str):
|
323
334
|
raise ValueError("stmt is not a string")
|
324
335
|
if args and bulk_args:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|