marcboeker / go-duckdb

go-duckdb provides a database/sql driver for the DuckDB database engine.
MIT License
583 stars 96 forks source link

Auto-load / auto-install in go-duckdb? And packaging JSON? #228

Open carlopi opened 1 month ago

carlopi commented 1 month ago

Hi!

I was reviewing various DuckDB clients (congrats on moving to 1.0.0 already!), and noticed there is some homogeneity in how some build variables are configured.

  1. Other clients often come with auto-install and auto-load enabled, should that turned on also for go?

  2. Other clients package the the JSON extensions as statically-linked extension, would that make sense here? Idea is that it's among the most common file formats (together with CSV and parquet, but they comes as bundled-in in any case). Many clients also package ICU as statically-linked extension.

Unsure what's the view of go-duckdb on both point, once I saw there was a difference I thought it was worth writing this.

Keep up the good work, Carlo


Code side changing this should be simple, for autoinstall and autoloading it should be a matter of adding ENABLE_EXTENSION_AUTOLOADING=1 and ENABLE_EXTENSION_AUTOINSTALL=1 to DUCKDB_COMMON_BUILD_FLAGS in the Makefile. Bundled extensions should be doable via BUILD_EXTENSIONS="json" (also to the Makefile's build flags), but some testing (maybe adding a test for this behaviour in CI is to be considered) could be nice.

carlopi commented 1 month ago

On autoloading and autoinstall, the defaults at Makefile level will eventually become having both enabled, but for now they need explicit opt-in by whoever builds and distribute DuckDB-based libraries.