From 1a92bd3b2ff130f4b668bb4ff9c24909cb0760a1 Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Mon, 30 Nov 2026 09:20:10 +0900 Subject: [PATCH] docs(#453): to_json_list() gives ISO text for a top-level date of an openCypher RETURN The how-to said a DATE or DATETIME is always epoch milliseconds in to_json_list(). On the CI wheels of main both builds return ISO text for such a property as an openCypher column of its own, and milliseconds inside a list or a map. No code and no output changes. Refs #453 --- docs/modules/ROOT/pages/how-to/databases-and-queries.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/how-to/databases-and-queries.adoc b/docs/modules/ROOT/pages/how-to/databases-and-queries.adoc index 73d0863..8deb72f 100644 --- a/docs/modules/ROOT/pages/how-to/databases-and-queries.adoc +++ b/docs/modules/ROOT/pages/how-to/databases-and-queries.adoc @@ -271,7 +271,7 @@ A query vector for `vectorNeighbors` can be a numpy array or a list. This sectio * `first()` returns the first row, or `None` when there is none, so `if db.query(...).first():` tests whether anything matched. * `to_list()` materialises the whole result as a list of dicts, one Python dict per row. Use it for a small result, or when you need the whole result in memory; iterate when you stop early. For a large result, see <>. -* `to_json_list(batch_size=10_000)` returns the rows as a list of JSON-native dicts, the same on both builds. A `DATE` or `DATETIME` is a number of epoch milliseconds, a record id is its text, and every `DECIMAL` is a `float` whatever its scale, so `Decimal("3")` is `3.0` and one column has one Python type. A `float` keeps about 17 significant digits, so a `DECIMAL` with more digits is rounded: `to_list()` returns the `Decimal` with every digit. +* `to_json_list(batch_size=10_000)` returns the rows as a list of JSON-native dicts, the same on both builds. A `DATE` or `DATETIME` is a number of epoch milliseconds, with one exception: a date or datetime property that an openCypher `RETURN` gives as a column of its own is ISO text on both builds (`RETURN t.day` gives `+"2026-01-02"+` and `RETURN t.ts` gives `+"2026-01-02T03:04:05.678"+`), while the same values inside a list or a map are numbers (https://github.com/ArcadeData/arcadedb-python/issues/453[#453]). A record id is its text, and every `DECIMAL` is a `float` whatever its scale, so `Decimal("3")` is `3.0` and one column has one Python type. A `float` keeps about 17 significant digits, so a `DECIMAL` with more digits is rounded: `to_list()` returns the `Decimal` with every digit. * `iter_json_batches(batch_size=10_000)` yields the rows as lists of JSON-native dicts, `batch_size` rows per list (the last may be shorter), with the same values as `to_json_list()`. On the native build `batch_size` bounds memory: the result set holds one reply of the cursor (2048 rows) and one batch at a time, and reads the next reply only when the next batch is asked for, so a large result is never held whole. On the JVM build a batch is serialised on the Java side one at a time. `to_list()`, `to_json_list()`, `to_dataframe()`, `to_columns()`, `to_arrow()` and `to_polars()` still hold the whole result, because they return it whole. + One laptop study on the native build, 1,000,000 rows read with `batch_size=10_000`, 10 clean pairs of this change against the previous behaviour; each figure is the ratio of the new value to the old one, so below 1 is lower. Peak RSS: 0.286 (95% interval 0.284 to 0.289). Time to the first batch: 0.010 (95% interval 0.009 to 0.010). Wall time of the whole read: 0.958 (95% interval 0.952 to 0.966). This is one machine and one result shape, not a speed promise.