diff --git a/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj b/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj index 26b945243a705d3adf3c1d521bd4ebdbbf10dde0..8e88da5a220a95a2f5bddec919045b47153cdac0 100644 --- a/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj +++ b/modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj @@ -217,6 +217,9 @@ (str/starts-with? raw-data-type "INT") "INTEGER" ;; INT64 (str/starts-with? raw-data-type "FLOAT") "FLOAT" ;; FLOAT 64 (str/starts-with? raw-data-type "STRING") "STRING" ;; STRING(255) + (str/starts-with? raw-data-type "BYTES") "BYTES" ;; BYTES(255) + (str/starts-with? raw-data-type "NUMERIC") "NUMERIC" ;; NUMERIC(255) + (str/starts-with? raw-data-type "BIGNUMERIC") "BIGNUMERIC" ;; BIGNUMERIC(255) (= raw-data-type "BOOL") "BOOLEAN" :else raw-data-type)] [database-type (database-type->base-type database-type)])) diff --git a/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj b/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj index f426cf19f8cd3a11a288e4ac4665a89768432a28..b785ed7120a8ec9e2fdddff232a28bedff2ec44a 100644 --- a/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj +++ b/modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk_test.clj @@ -227,13 +227,23 @@ " decimal_col DECIMAL, " " bignumeric_col BIGNUMERIC, " " bigdecimal_col BIGDECIMAL, " - " string255_col STRING(255)) " - "AS SELECT NUMERIC '%s', DECIMAL '%s', BIGNUMERIC '%s', BIGDECIMAL '%s', 'hello'") + " string255_col STRING(255), " + " bytes32_col BYTES(32), " + " numeric29_col NUMERIC(29), " + " decimal29_col DECIMAL(29), " + " bignumeric32_col BIGNUMERIC(32), " + " bigdecimal76_col BIGDECIMAL(76,38))" + "AS SELECT NUMERIC '%s', DECIMAL '%s', BIGNUMERIC '%s', BIGDECIMAL '%s', 'hello', " + " B'mybytes', NUMERIC '%s', DECIMAL '%s', BIGNUMERIC '%s', BIGDECIMAL '%s'") ~test-db-name tbl-nm# ~numeric-val ~decimal-val ~bignumeric-val + ~bigdecimal-val + ~numeric-val + ~decimal-val + ~bignumeric-val ~bigdecimal-val]) (fn [tbl-nm#] ["DROP TABLE IF EXISTS `%s.%s`" ~test-db-name tbl-nm#]) (fn [~(or table-name-binding '_)] ~@body))) @@ -757,7 +767,42 @@ :database-type "STRING", :base-type :type/Text, :database-partitioned false, - :database-position 4}] + :database-position 4} + {:name "bytes32_col", + :table-name tbl-nm, + :table-schema test-db-name, + :database-type "BYTES", + :base-type :type/*, + :database-partitioned false, + :database-position 5} + {:name "numeric29_col", + :table-name tbl-nm, + :table-schema test-db-name, + :database-type "NUMERIC", + :base-type :type/Decimal, + :database-partitioned false, + :database-position 6} + {:name "decimal29_col", + :table-name tbl-nm, + :table-schema test-db-name, + :database-type "NUMERIC", + :base-type :type/Decimal, + :database-partitioned false, + :database-position 7} + {:name "bignumeric32_col", + :table-name tbl-nm + :table-schema test-db-name + :database-type "BIGNUMERIC", + :base-type :type/Decimal, + :database-partitioned false, + :database-position 8} + {:name "bigdecimal76_col", + :table-name tbl-nm + :table-schema test-db-name + :database-type "BIGNUMERIC", + :base-type :type/Decimal, + :database-partitioned false, + :database-position 9}] (driver/describe-fields :bigquery-cloud-sdk (mt/db) {:table-names [tbl-nm] :schema-names [test-db-name]})) "`describe-fields` should see the fields in the table") (sync/sync-database! (mt/db) {:scan :schema})