DuckDB Versions
barca[sql] accepts duckdb 1.4 up to (not including) 3, and barca’s tests run on 1.x and 2.x.
duckdb 1.1 to 1.3 are not supported (on 1.1, for one, dataset sinks fail).
Moving a pipeline to duckdb 2 can need these changes in your own code (checked with 2.0.0):
- Relations no longer have
fetchone(),fetchmany(),fetch_df_chunk()orexecute().rel.fetchone()becomesrel.limit(1).fetchall()[0]andrel.fetchone()[0]becomesrel.fetchall()[0][0]; both also work on 1.x. The step fails withAttributeErrorotherwise. - A result of
duckdb.execute(...)that has not been read to the end (for exampleduckdb.execute(q).fetchone()) blocks any other work on the connection:ResourceInUseException: ... unfinished result from execute(). Barca discards such a result when the step returns, so it does not stop the returned relation from being written or the next step from running, but a laterduckdb.sql(...)in the same step fails. Useduckdb.sql(q).fetchall(), read the result to the end, or callabort()on the connection. fetch_arrow_table()andfetch_record_batch()on a relation warn (DeprecationWarning); useto_arrow_table()andto_arrow_reader().rel.arrow()returns aRecordBatchReaderthat can be read once (every version barca supports);to_arrow_table()returns a table.- SQL: the
x -> x + 1lambda syntax is a binder error (uselambda x: x + 1, which 1.x also accepts), and integer//or%by zero raises instead of returning NULL (wrap it inTRY(...)). DuckDB’s migration guide lists the rest: https://duckdb.org/docs/2.0/operations_manual/migration barca sqlwith a statement that returns no rows (SET,CREATE ...) reports no columns on duckdb 1.x and DuckDB’s status column on duckdb 2 ("columns": ["Success"]forSET,CountforCREATE), with no rows either way.- Database files. A
.duckdbfile that duckdb 2 creates cannot be opened by duckdb 1.x (Trying to read a database file with version number 69). Barca’s own artifacts are parquet, csv and json files, which both read; this applies to database files your pipeline opens withduckdb.connect(path)orATTACH. If workers or machines on 1.x share such a file, upgrade them together, or create it withATTACH 'file.duckdb' (STORAGE_VERSION 'v1.5.0')so 1.x can still open it.
See also: barca docs types, barca docs big-inputs, barca docs sql, barca docs examples/duckdb.