Skip to content

Commit cad5509

Browse files
committed
Marshalling: Disable option orjson.OPT_PASSTHROUGH_DATETIME
1 parent 20e735f commit cad5509

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/crate/client/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def _create_sql_payload(stmt, args, bulk_args):
343343
return orjson.dumps(
344344
data,
345345
default=cratedb_json_encoder,
346-
option=(orjson.OPT_PASSTHROUGH_DATETIME | orjson.OPT_SERIALIZE_NUMPY),
346+
option=orjson.OPT_SERIALIZE_NUMPY,
347347
)
348348

349349

tests/client/test_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def test_datetime_is_converted_to_ts(self, request):
318318
# convert string to dict
319319
# because the order of the keys isn't deterministic
320320
data = json.loads(request.call_args[1]["data"])
321-
self.assertEqual(data["args"], [1425108700000])
321+
self.assertEqual(data["args"], ["2015-02-28T07:31:40"])
322322
client.close()
323323

324324
@patch(REQUEST, autospec=True)
@@ -329,7 +329,7 @@ def test_date_is_converted_to_ts(self, request):
329329
day = dt.date(2016, 4, 21)
330330
client.sql("insert into users (dt) values (?)", (day,))
331331
data = json.loads(request.call_args[1]["data"])
332-
self.assertEqual(data["args"], [1461196800000])
332+
self.assertEqual(data["args"], ["2016-04-21"])
333333
client.close()
334334

335335
def test_socket_options_contain_keepalive(self):

0 commit comments

Comments
 (0)