diff --git a/src/metabase/driver/greptimedb.clj b/src/metabase/driver/greptimedb.clj index 29a5564..c2595a1 100644 --- a/src/metabase/driver/greptimedb.clj +++ b/src/metabase/driver/greptimedb.clj @@ -17,7 +17,9 @@ [metabase.util :as u] [metabase.util.date-2 :as u.date] [metabase.util.honey-sql-2 :as h2x] - [metabase.util.log :as log])) + [metabase.util.log :as log]) + (:import + [java.sql Connection])) (set! *warn-on-reflection* true) @@ -201,6 +203,17 @@ [_] "SET time_zone = %s;") +(defmethod sql-jdbc.execute/do-with-connection-with-options :greptimedb + [driver db-or-id-or-spec {:keys [^String session-timezone write?], :as options} f] + (sql-jdbc.execute/do-with-resolved-connection + driver + db-or-id-or-spec + options + (fn [^Connection conn] + (when-not (sql-jdbc.execute/recursive-connection?) + (sql-jdbc.execute/set-time-zone-if-supported! driver conn session-timezone)) + (f conn)))) + ;;; ------------------------------------------------- date functions ------------------------------------------------- ;;;; Datetime truncation functions