Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
DuckDB 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexR2D2 committed Feb 28, 2024
1 parent 357cf3c commit 8f927d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}}
2 changes: 1 addition & 1 deletion resources/metabase-plugin.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 8 additions & 6 deletions src/metabase/driver/duckdb.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]))

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8f927d5

Please sign in to comment.