Skip to content

Commit f27f762

Browse files
authored
Merge pull request #185 from MITLibraries/USE-449-handle-duckdb-v1.5
USE 449 - Update for DuckDB 1.5 compatibility
2 parents d58ecce + 2ab502a commit f27f762

5 files changed

Lines changed: 189 additions & 194 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "timdex_dataset_api"
7-
version = "4.0.0"
7+
version = "4.1.0"
88
description = "Python library for interacting with a TIMDEX parquet dataset"
99
readme = "README.md"
1010
requires-python = ">=3.12"

timdex_dataset_api/dataset.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,7 @@ def _iter_data_chunks(self, data_query: str) -> Iterator[pa.RecordBatch]:
622622
self.conn.execute("""set threads=16;""")
623623
try:
624624
cursor = self.conn.execute(data_query)
625-
yield from cursor.fetch_record_batch(
626-
rows_per_batch=self.config.read_batch_size
627-
)
625+
yield from cursor.to_arrow_reader(batch_size=self.config.read_batch_size)
628626
finally:
629627
if self.location_scheme == "s3":
630628
self.conn.execute(f"""set threads={self.conn_factory.threads};""")

timdex_dataset_api/embeddings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ def read_batches_iter(
372372
**filters,
373373
)
374374
cursor = self.conn.execute(data_query)
375-
yield from cursor.fetch_record_batch(
376-
rows_per_batch=self.timdex_dataset.config.read_batch_size
375+
yield from cursor.to_arrow_reader(
376+
batch_size=self.timdex_dataset.config.read_batch_size
377377
)
378378

379379
logger.debug(f"read() elapsed: {round(time.perf_counter() - start_time, 2)}s")

timdex_dataset_api/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def _install_extensions(self, conn: DuckDBPyConnection) -> None:
161161
secrets_dir.mkdir(parents=True, exist_ok=True)
162162
extensions_dir.mkdir(parents=True, exist_ok=True)
163163

164+
conn.execute(f"set home_directory='{duckdb_home.as_posix()}';")
164165
conn.execute(f"set secret_directory='{secrets_dir.as_posix()}';")
165166
conn.execute(f"set extension_directory='{extensions_dir.as_posix()}';")
166167

0 commit comments

Comments
 (0)