Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
b5464b17
Unverified
Commit
b5464b17
authored
7 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Make sure GA describe-table returns database-type
parent
e91bdb0f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/googleanalytics.clj
+11
-9
11 additions, 9 deletions
src/metabase/driver/googleanalytics.clj
test/metabase/driver/googleanalytics_test.clj
+7
-7
7 additions, 7 deletions
test/metabase/driver/googleanalytics_test.clj
with
18 additions
and
16 deletions
src/metabase/driver/googleanalytics.clj
+
11
−
9
View file @
b5464b17
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
test/metabase/driver/google
_
analytics_test.clj
→
test/metabase/driver/googleanalytics_test.clj
+
7
−
7
View file @
b5464b17
(
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"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment