Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

[Vertica] Support Vertica UUID columns as `:type/UUID` (#62512)

Braden Shepherdsoncd0965a29902
diff --git a/modules/drivers/vertica/src/metabase/driver/vertica.clj b/modules/drivers/vertica/src/metabase/driver/vertica.clj
index fbd7bef075f..6eff0b7f2b1 100644
--- a/modules/drivers/vertica/src/metabase/driver/vertica.clj
+++ b/modules/drivers/vertica/src/metabase/driver/vertica.clj
@@ -34,6 +34,7 @@
:expression-literals true
:now true
:identifiers-with-spaces true
+ :uuid-type true
:percentile-aggregations false
:test/jvm-timezone-setting false
:database-routing false}]
@@ -56,6 +57,7 @@
:Numeric :type/Decimal
:Double :type/Decimal
:Float :type/Float
+ :Uuid :type/UUID
:Date :type/Date
:Time :type/Time
:TimeTz :type/TimeWithLocalTZ
diff --git a/modules/drivers/vertica/test/metabase/test/data/vertica.clj b/modules/drivers/vertica/test/metabase/test/data/vertica.clj
index ae51996ef50..bfb3db836a1 100644
--- a/modules/drivers/vertica/test/metabase/test/data/vertica.clj
+++ b/modules/drivers/vertica/test/metabase/test/data/vertica.clj
@@ -49,7 +49,8 @@
:type/Integer "INTEGER"
:type/Text "VARCHAR(1024)"
:type/Time "TIME"
- :type/TimeWithTZ "TIMETZ"}]
+ :type/TimeWithTZ "TIMETZ"
+ :type/UUID "UUID"}]
(defmethod sql.tx/field-base-type->sql-type [:vertica base-type] [_ _] sql-type))
(mu/defn- db-name :- :string
@@ -121,16 +122,13 @@
"Dump a sequence of rows (as vectors) to a CSV file."
[{:keys [field-definitions rows]} ^String filename]
(try
- (let [has-custom-pk? (when-let [pk (not-empty (sql.tx/fielddefs->pk-field-names field-definitions))]
- (not= ["id"] pk))
+ (let [needs-pk? (empty? (sql.tx/fielddefs->pk-field-names field-definitions))
column-names (cond->> (mapv :field-name field-definitions)
- (not has-custom-pk?)
- (cons "id"))
+ needs-pk? (cons "id"))
rows-with-id (for [[i row] (m/indexed rows)]
(cond->> (for [v row]
(value->csv v))
- (not has-custom-pk?)
- (cons (inc i))))
+ needs-pk? (cons (inc i))))
csv-rows (cons column-names rows-with-id)]
(try