AlexR2D2 / metabase_duckdb_driver

Metabase DuckDB Driver shipped as 3rd party plugin
Apache License 2.0
75 stars 25 forks source link

Update to DuckDB v0.9.0 #19

Closed parastripathi closed 11 months ago

parastripathi commented 1 year ago

Hello Alex 👋 DuckDB released the support for iceberg tables in v0.9.0 supporting it in the upcoming release can help it greatly in adopting datalakehouse uses. I have never worked with Clojure but I am open to finding the steps that can help update this driver. Please let me know how I can contribute.

I know this is a preview release just let me know if I can help with it or v0.9.1 update that is planned on Wednesday, Oct 11, 2023

Source: https://duckdb.org/dev/release-dates

Thanks, Paras Tripathi

AlexR2D2 commented 1 year ago

HI, thanks! Already updated up to 0.9.1 Also i fixed small Date=NULL issue

Below the steps to build the driver

  1. Please, read about the vscode devcontainers
  2. Create a folder (for example duckdb_plugin), and cd into the duckdb_plugin folder
  3. Create subfolder .devcontainer and add into the devcontainer.json
  4. Open duckdb_plugin folder in vscode as devcontainer. Wait until it loads and prepares all required stuff
  5. Open terminal in the vs code project your just created (you must be in root of duckdb_plugin folder)
  6. Clone the metabase_duckdb_driver
  7. Patch the metabase_duckdb_driver /deps.edn file. The duckdb deps.edn file should looks like this:

    {:paths
    ["src" "resources"]
    
    :deps
    {org.duckdb/duckdb_jdbc {:mvn/version "0.9.1"}}} 
  8. Clone required metabase repository (for example) > git clone --depth 1 --branch v1.46.2 https://github.com/metabase/metabase.git
  9. Create duckdb driver directory in the cloned metabase sourcecode > mkdir -p metabase/modules/drivers/duckdb
  10. Copy duckdb source code into created dir > cp -rf metabase_duckdb_driver/* metabase/modules/drivers/duckdb/
  11. Add duckdb record to the deps file metabase/modules/drivers/deps.edn. File sholud looks like this:
    ...
    metabase/sqlserver          {:local/root "sqlserver"}
    metabase/vertica            {:local/root "vertica"}
    metabase/duckdb             {:local/root "duckdb"}}}  <- add this
  12. Build duckdb driver
    > cd metabase
    > clojure -X:build:drivers:build/driver :driver :duckdb
  13. jar file of duckdb driver will be generated here metabase/resources/modules/duckdb.metabase-driver.jar. you can access this file outside the vs code by path duckdb_plugin/metabase/resources/modules/duckdb.metabase-driver.jar

That is it. Now you have you own duckdb.metabase-driver.jar plugin and you can copy it into metabase plugins dir.

parastripathi commented 1 year ago

Thanks a lot, Alex. I will try this out.