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
f1af72f1
Commit
f1af72f1
authored
9 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
nicer formatting for the korma form in Generic SQL QP output
parent
285370c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/driver/generic_sql/query_processor.clj
+7
-2
7 additions, 2 deletions
src/metabase/driver/generic_sql/query_processor.clj
with
7 additions
and
2 deletions
src/metabase/driver/generic_sql/query_processor.clj
+
7
−
2
View file @
f1af72f1
...
...
@@ -2,6 +2,7 @@
"The Query Processor is responsible for translating the Metabase Query Language into korma SQL forms."
(
:require
[
clojure.core.match
:refer
[
match
]]
[
clojure.tools.logging
:as
log
]
[
clojure.walk
:as
walk
]
[
korma.core
:refer
:all
]
[
metabase.config
:as
config
]
[
metabase.driver.query-processor
:as
qp
]
...
...
@@ -201,7 +202,11 @@
[
korma-form
]
(
when-not
qp/*disable-qp-logging*
(
log/debug
(
u/format-color
'green
"\n\nKORMA FORM:\n%s"
(
u/pprint-to-str
korma-form
))
(
u/format-color
'green
"\n\nKORMA FORM:\n%s"
(
->>
(
nth
korma-form
2
)
; korma form is wrapped in a let clause. Discard it
(
walk/prewalk
(
fn
[
form
]
; strip korma.core/ qualifications from symbols in the form
(
if-not
(
symbol?
form
)
form
; to remove some of the clutter
(
symbol
(
name
form
)))))
(
u/pprint-to-str
)))
(
u/format-color
'blue
"\nSQL:\n%s\n"
(
eval
(
let
[[
let-form
binding-form
&
body
]
korma-form
]
; wrap the (select ...) form in a sql-only clause
`
(
~
let-form
~
binding-form
; has to go there to work correctly
(
sql-only
~@
body
))))))))
(
sql-only
~@
body
))))))))
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