diff --git a/deps.edn b/deps.edn index 5e19c6b..8333810 100755 --- a/deps.edn +++ b/deps.edn @@ -2,4 +2,4 @@ ["src" "resources"] :deps - {org.duckdb/duckdb_jdbc {:mvn/version "0.8.1"}}} + {org.duckdb/duckdb_jdbc {:mvn/version "0.10.0"}}} diff --git a/resources/metabase-plugin.yaml b/resources/metabase-plugin.yaml index 4e4ae5e..8f8a217 100755 --- a/resources/metabase-plugin.yaml +++ b/resources/metabase-plugin.yaml @@ -1,6 +1,6 @@ info: name: Metabase DuckDB Driver - version: 1.0.0-SNAPSHOT-0.1.9 + version: 1.0.0-SNAPSHOT-0.1.11 description: Allows Metabase to connect to DuckDB databases. contact-info: name: Alexander Golubov diff --git a/src/metabase/driver/duckdb.clj b/src/metabase/driver/duckdb.clj index e6dc590..ba64137 100755 --- a/src/metabase/driver/duckdb.clj +++ b/src/metabase/driver/duckdb.clj @@ -4,9 +4,9 @@ [medley.core :as m] [metabase.driver :as driver] [metabase.driver.sql-jdbc.connection :as sql-jdbc.conn] - [metabase.driver.sql-jdbc.execute :as sql-jdbc.execute] + [metabase.driver.sql-jdbc.execute :as sql-jdbc.execute] [metabase.driver.sql-jdbc.sync :as sql-jdbc.sync] - [metabase.driver.sql.query-processor :as sql.qp] + [metabase.driver.sql.query-processor :as sql.qp] [metabase.util.honeysql-extensions :as hx]) (:import [java.sql Statement ResultSet ResultSetMetaData Types])) @@ -74,16 +74,18 @@ ;; .getObject of DuckDB (v0.4.0) does't handle the java.time.LocalDate but sql.Date only, ;; so get the sql.Date from DuckDB and convert it to java.time.LocalDate (defmethod sql-jdbc.execute/read-column-thunk [:duckdb Types/DATE] - [_ ^ResultSet rs _ ^Integer i] + [_ ^ResultSet rs _rsmeta ^Integer i] (fn [] - (let [sqlDate (.getObject rs i java.sql.Date)] (.toLocalDate sqlDate)))) + (when-let [sqlDate (.getDate rs i)] + (.toLocalDate sqlDate)))) ;; .getObject of DuckDB (v0.4.0) does't handle the java.time.LocalTime but sql.Time only, ;; so get the sql.Time from DuckDB and convert it to java.time.LocalTime (defmethod sql-jdbc.execute/read-column-thunk [:duckdb Types/TIME] - [_ ^ResultSet rs _ ^Integer i] + [_ ^ResultSet rs _rsmeta ^Integer i] (fn [] - (let [sqlTime (.getObject rs i java.sql.Time)] (.toLocalTime sqlTime)))) + (when-let [sqlTime (.getTime rs i)] + (.toLocalTime sqlTime)))) ;; date processing for aggregation