diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5d060eb..fb69f6b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -17,8 +17,7 @@ jobs: uses: actions/checkout@v2 with: repository: metabase/metabase - # The latest commit on release-0.47.x branch - fixed failing MB tests - ref: dba05c0b6f6cbc6e2f8247c03cc5fcc986cd3fe5 + ref: v0.47.8 - name: Checkout Driver Repo uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index db0d2c0..b35a0b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.2.4 + +Metabase 0.47.7+ only. + +### Bug fixes +* Fixed UI question -> SQL conversion creating incorrect queries due to superfluous spaces in columns/tables/database names. + # 1.2.3 ### Bug fixes diff --git a/README.md b/README.md index 224b09b..a3b515c 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ docker run -d -p 3000:3000 \ | 0.45.x | 1.1.0 | | 0.46.x | 1.1.7 | | 0.47.x | 1.2.3 | +| 0.47.7+ | 1.2.4 | ## Creating a Metabase Docker image with ClickHouse driver diff --git a/docker-compose.yml b/docker-compose.yml index 643ae7a..53fcb82 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: hostname: server.clickhouseconnect.test metabase: - image: metabase/metabase:v0.47.2 + image: metabase/metabase:v0.47.8 container_name: metabase-with-clickhouse-driver environment: 'MB_HTTP_TIMEOUT': '5000' diff --git a/resources/metabase-plugin.yaml b/resources/metabase-plugin.yaml index 50e95a4..f61be2c 100644 --- a/resources/metabase-plugin.yaml +++ b/resources/metabase-plugin.yaml @@ -1,6 +1,6 @@ info: name: Metabase ClickHouse Driver - version: 1.2.3 + version: 1.2.4 description: Allows Metabase to connect to ClickHouse databases. contact-info: name: ClickHouse diff --git a/src/metabase/driver/clickhouse.clj b/src/metabase/driver/clickhouse.clj index 6ab4378..fee6e62 100644 --- a/src/metabase/driver/clickhouse.clj +++ b/src/metabase/driver/clickhouse.clj @@ -1,7 +1,9 @@ (ns metabase.driver.clickhouse "Driver for ClickHouse databases" + #_{:clj-kondo/ignore [:unsorted-required-namespaces]} (:require [clojure.java.jdbc :as jdbc] [clojure.string :as str] + [metabase [config :as config]] [metabase.driver :as driver] [metabase.driver.clickhouse-introspection] [metabase.driver.clickhouse-nippy] @@ -11,14 +13,17 @@ [metabase.driver.sql-jdbc [common :as sql-jdbc.common] [connection :as sql-jdbc.conn] [sync :as sql-jdbc.sync]] - [metabase [config :as config]])) + [metabase.driver.sql.util :as sql.u])) (set! *warn-on-reflection* true) (driver/register! :clickhouse :parent :sql-jdbc) (defmethod driver/display-name :clickhouse [_] "ClickHouse") -(def ^:private product-name "metabase/1.2.3") +(def ^:private product-name "metabase/1.2.4") + +(defmethod driver/prettify-native-form :clickhouse [_ native-form] + (sql.u/format-sql-and-fix-params :mysql native-form)) (doseq [[feature supported?] {:standard-deviation-aggregations true :foreign-keys (not config/is-test?) diff --git a/test/metabase/driver/clickhouse_test.clj b/test/metabase/driver/clickhouse_test.clj index 4d1a889..1f97a85 100644 --- a/test/metabase/driver/clickhouse_test.clj +++ b/test/metabase/driver/clickhouse_test.clj @@ -724,11 +724,8 @@ :clickhouse (let [query (data/mbql-query venues {:fields [$id] :order-by [[:asc $id]] :limit 5}) {compiled :query} (qp/compile-and-splice-parameters query) - _pretty (mdb.query/format-sql compiled :clickhouse)] + pretty (driver/prettify-native-form :clickhouse compiled)] (testing "compiled" (is (= "SELECT `test_data`.`venues`.`id` AS `id` FROM `test_data`.`venues` ORDER BY `test_data`.`venues`.`id` ASC LIMIT 5" compiled))) - ;; Ignored due to Metabase bug, see https://github.com/metabase/metabase/issues/34235 - ;; FIXME: uncomment once it is resolved - ;; (testing "pretty" - ;; (is (= "SELECT\n `test_data`.`venues`.`id` AS `id`\nFROM `test_data`.`venues`\nORDER BY\n `test_data`.`venues`.`id` ASC\nLIMIT\n 5" pretty))) - ))) + (testing "pretty" + (is (= "SELECT\n `test_data`.`venues`.`id` AS `id`\nFROM\n `test_data`.`venues`\nORDER BY\n `test_data`.`venues`.`id` ASC\nLIMIT\n 5" pretty)))))) diff --git a/test/metabase/test/data/clickhouse.clj b/test/metabase/test/data/clickhouse.clj index 610b9ff..0ca82c7 100644 --- a/test/metabase/test/data/clickhouse.clj +++ b/test/metabase/test/data/clickhouse.clj @@ -90,7 +90,7 @@ :ssl false :use_no_proxy false :use_server_time_zone_for_dates true - :product_name "metabase/1.2.3"}) + :product_name "metabase/1.2.4"}) (defn rows-without-index "Remove the Metabase index which is the first column in the result set"