Skip to content

Commit

Permalink
Whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
crisptrutski committed Oct 1, 2024
1 parent 67c83dd commit 3543dfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 7 additions & 8 deletions src/metabase/driver/clickhouse.clj
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@
(defn- create-table!-sql
"Creates a ClickHouse table with the given name and column definitions. It assumes the engine is MergeTree,
so it only works with Clickhouse Cloud and single node on-premise deployments at the moment."
[driver table-name column-definitions & {:keys [primary-key] :as opts}]
[_driver table-name column-definitions & {:keys [primary-key] :as opts}]
(str/join "\n"
[(#'sql-jdbc/create-table!-sql :sql-jdbc table-name column-definitions opts)
"ENGINE = MergeTree"
(format "ORDER BY (%s)" (str/join ", " (map quote-name primary-key)))
;; disable insert idempotency to allow duplicate inserts
"SETTINGS replicated_deduplication_window = 0"]))
[(#'sql-jdbc/create-table!-sql :sql-jdbc table-name column-definitions opts)
"ENGINE = MergeTree"
(format "ORDER BY (%s)" (str/join ", " (map quote-name primary-key)))
;; disable insert idempotency to allow duplicate inserts
"SETTINGS replicated_deduplication_window = 0"]))

(defmethod driver/create-table! :clickhouse
[driver db-id table-name column-definitions & {:keys [primary-key]}]
Expand Down Expand Up @@ -290,8 +290,7 @@
quoted-role (->> (clojure.string/split role #",")
(map quote-if-needed)
(clojure.string/join ","))]
(format "SET ROLE %s;" quoted-role))
)
(format "SET ROLE %s;" quoted-role)))

(defmethod driver.sql/default-database-role :clickhouse
[_ _]
Expand Down
6 changes: 3 additions & 3 deletions test/metabase/driver/clickhouse_impersonation_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
(is true))
(testing "does not throw with a role containing hyphens"
(sql-jdbc.execute/do-with-connection-with-options
:clickhouse spec nil
(fn [^java.sql.Connection conn]
(driver/set-role! :clickhouse conn "metabase-test-role")))
:clickhouse spec nil
(fn [^java.sql.Connection conn]
(driver/set-role! :clickhouse conn "metabase-test-role")))
(is true))
(testing "does not throw with the default role"
(sql-jdbc.execute/do-with-connection-with-options
Expand Down

0 comments on commit 3543dfc

Please sign in to comment.