Skip to content

Commit 156e165

Browse files
authored
Upgrade duckdb and raise maximum tested python version (#65)
The last PR caught that the changes for the server side transform aren't compatible with older versions of duckdb. It was already getting unwieldy and so I chose to make the necessary changes in another PR. This raises the minimum supported version of DuckDB and also starts testing against python 3.14. There has been an ongoing cache contention issue resulting in long build times that is also resolved here.
1 parent f141ab5 commit 156e165

12 files changed

Lines changed: 1097 additions & 236 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- uses: pdm-project/setup-pdm@v4
2222
with:
2323
cache: true
24-
cache-dependency-path: pylock.toml
25-
- run: pdm install -G:all --lockfile pylock.toml
24+
cache-dependency-path: pylock.lint.toml
25+
- run: pdm install -G:all --lockfile pylock.lint.toml
2626
- uses: jaxxstorm/action-install-gh-release@v1.10.0
2727
with:
2828
repo: houseabsolute/precious

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
# install dependencies
5252
- uses: pdm-project/setup-pdm@v4
5353
with:
54-
python-version: 3.13
54+
python-version: 3.14
5555
cache: true
5656
cache-dependency-path: pylock.maximal.toml
5757
- run: pdm install -G:all --lockfile pylock.maximal.toml

environment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ channels:
55
- nodefaults
66
dependencies:
77
- python>=3.10,<3.11
8-
- pdm==2.25.5
9-
- precious==0.10.0
8+
- pdm==2.26.6
9+
- precious==0.10.2
1010
- libpq>=13.0

pylock.lint.toml

Lines changed: 827 additions & 0 deletions
Large diffs are not rendered by default.

pylock.maximal.toml

Lines changed: 64 additions & 115 deletions
Large diffs are not rendered by default.

pylock.minimal.toml

Lines changed: 47 additions & 35 deletions
Large diffs are not rendered by default.

pylock.toml

Lines changed: 56 additions & 50 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ authors = [
1111
{ name = "Nassib Nassar", email = "nassib@indexdata.com" },
1212
]
1313
dependencies = [
14-
# Versions lower than 0.9 have issues binding the custom functions
15-
# 1.4 has a number of regressions so I'm letting it shake out until some fixes
16-
"duckdb>=0.9.2,<1.4",
14+
# 1.3 introduces json each
15+
"duckdb>=1.3",
1716
# 4.64 is the first release with type stubs
1817
"tqdm>=4.64.0",
1918
# 0.3 allows checking the path for id based paging
@@ -67,6 +66,9 @@ include = ["src/**"]
6766
distribution = true
6867
package-dir = "src"
6968

69+
[tool.pdm.resolution]
70+
allow-prereleases = false
71+
7072
[tool.pdm.scripts]
7173
test.composite = [
7274
"rm -f .coverage",
@@ -76,7 +78,8 @@ test.composite = [
7678
lock.composite = [
7779
"rm -f pylock.toml pylock.maximal.toml pylock.minimal.toml",
7880
"pdm lock --python=3.10",
79-
"pdm lock --lockfile pylock.maximal.toml --python=3.13",
81+
"cp pylock.toml pylock.lint.toml",
82+
"pdm lock --lockfile pylock.maximal.toml --python=3.14",
8083
"pdm lock --strategy direct_minimal_versions --lockfile pylock.minimal.toml --python=3.10",
8184
]
8285
test-install.composite = [

src/ldlite/_csv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def to_csv(
6464
s += ","
6565
if attrs[i][1] in [
6666
"NUMBER",
67+
"DECIMAL(18,3)",
6768
"bigint",
6869
"numeric",
6970
20,

src/ldlite/database/_duckdb.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ def __init__(self, db: duckdb.DuckDBPyConnection) -> None:
2424

2525
@staticmethod
2626
def _setup_jfuncs(conn: duckdb.DuckDBPyConnection) -> None:
27-
with conn.cursor() as cur:
28-
cur.execute("SELECT string_split(ltrim(version(),'v'), '.') AS has_lambda;")
29-
if ver := cur.fetchone():
30-
(ma, mi, _) = ver[0]
31-
if int(ma) > 1 and int(mi) >= 3:
32-
cur.execute("SET lambda_syntax = 'ENABLE_SINGLE_ARROW';")
33-
3427
with conn.cursor() as cur:
3528
cur.execute(
3629
r"""
@@ -63,8 +56,8 @@ def _setup_jfuncs(conn: duckdb.DuckDBPyConnection) -> None:
6356
END
6457
WHEN 'array' THEN
6558
CASE
66-
WHEN length(list_filter((main.json_extract(j, p))::JSON[], x -> x != 'null'::JSON)) = 0 THEN 'null'::JSON
67-
ELSE list_filter((main.json_extract(j, p))::JSON[], x -> x != 'null'::JSON)
59+
WHEN length(list_filter((main.json_extract(j, p))::JSON[], lambda x : x != 'null'::JSON)) = 0 THEN 'null'::JSON
60+
ELSE list_filter((main.json_extract(j, p))::JSON[], lambda x : x != 'null'::JSON)
6861
END
6962
ELSE coalesce(main.json_extract(j, p), 'null'::JSON)
7063
END

0 commit comments

Comments
 (0)