Skip to content
Snippets Groups Projects
Commit a085ad78 authored by Cam Saül's avatar Cam Saül
Browse files

Handle unknown BigQuery column types gracefully [ci drivers]

parent 0c869f1a
No related branches found
No related tags found
No related merge requests found
......@@ -87,15 +87,17 @@
{:pre [client (seq project-id) (seq dataset-id) (seq table-id)]}
(google/execute (.get (.tables client) project-id dataset-id table-id))))
(def ^:private ^:const bigquery-type->base-type
{"BOOLEAN" :type/Boolean
"FLOAT" :type/Float
"INTEGER" :type/Integer
"RECORD" :type/Dictionary ; RECORD -> field has a nested schema
"STRING" :type/Text
"DATE" :type/Date
"DATETIME" :type/DateTime
"TIMESTAMP" :type/DateTime})
(defn- bigquery-type->base-type [field-type]
(case field-type
"BOOLEAN" :type/Boolean
"FLOAT" :type/Float
"INTEGER" :type/Integer
"RECORD" :type/Dictionary ; RECORD -> field has a nested schema
"STRING" :type/Text
"DATE" :type/Date
"DATETIME" :type/DateTime
"TIMESTAMP" :type/DateTime
:type/*))
(defn- table-schema->metabase-field-info [^TableSchema schema]
(for [^TableFieldSchema field (.getFields schema)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment