Skip to content
Snippets Groups Projects
Unverified Commit b5464b17 authored by Cam Saul's avatar Cam Saul
Browse files

Make sure GA describe-table returns database-type

parent e91bdb0f
Branches
Tags
No related merge requests found
......@@ -55,7 +55,7 @@
:schema nil}))})
;;; ---------------------------------------- describe-table ----------------------------------------
;;; ------------------------------------------------- describe-table -------------------------------------------------
(def ^:private ^:const redundant-date-fields
"Set of column IDs covered by `unit->ga-dimension` in the GA QP.
......@@ -101,11 +101,13 @@
column))))
(defn- describe-columns [database]
(set (for [^Column column (columns database)]
{:name (.getId column)
:base-type (if (= (.getId column) "ga:date")
:type/Date
(qp/ga-type->base-type (column-attribute column :dataType)))})))
(set (for [^Column column (columns database)
:let [ga-type (column-attribute column :dataType)]]
{:name (.getId column)
:base-type (if (= (.getId column) "ga:date")
:type/Date
(qp/ga-type->base-type ga-type))
:database-type ga-type})))
(defn- describe-table [database table]
{:name (:name table)
......@@ -114,14 +116,14 @@
;;;---------------------------------------- can-connect?----------------------------------------
;;; -------------------------------------------------- can-connect? --------------------------------------------------
(defn- can-connect? [details-map]
{:pre [(map? details-map)]}
(boolean (profile-ids {:details details-map})))
;;;---------------------------------------- execute-query----------------------------------------
;;; ------------------------------------------------- execute-query --------------------------------------------------
(defn- column-with-name ^Column [database-or-id column-name]
(some (fn [^Column column]
......@@ -185,7 +187,7 @@
(google/execute (mbql-query->request query)))
;;; ---------------------------------------- Driver ----------------------------------------
;;; ----------------------------------------------------- Driver -----------------------------------------------------
(defrecord GoogleAnalyticsDriver []
clojure.lang.Named
......
(ns metabase.driver.google-analytics-test
(ns metabase.driver.googleanalytics-test
"Tests for the Google Analytics driver and query processor."
(:require [expectations :refer :all]
[metabase.driver.googleanalytics.query-processor :as qp]
[metabase.query-processor.interface :as qpi]
[metabase.util :as u]))
;;; +------------------------------------------------------------------------------------------------------------------------+
;;; | QUERY "TRANSFORMATION |
;;; +------------------------------------------------------------------------------------------------------------------------+
;;; +----------------------------------------------------------------------------------------------------------------+
;;; | QUERY "TRANSFORMATION" |
;;; +----------------------------------------------------------------------------------------------------------------+
;; check that a built-in Metric gets removed from the query and put in `:ga`
(expect
......@@ -46,9 +46,9 @@
[:< 100 200]]}}))
;;; +------------------------------------------------------------------------------------------------------------------------+
;;; | MBQL->NATIVE (EXPANDED QUERY -> GA QUERY) |
;;; +------------------------------------------------------------------------------------------------------------------------+
;;; +----------------------------------------------------------------------------------------------------------------+
;;; | MBQL->NATIVE (EXPANDED QUERY -> GA QUERY) |
;;; +----------------------------------------------------------------------------------------------------------------+
(defn- ga-query [inner-query]
{:query (merge {:ids "ga:0123456"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment