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
3a9391d8
Commit
3a9391d8
authored
9 years ago
by
Cameron T Saul
Browse files
Options
Downloads
Patches
Plain Diff
nicer indentation for metabase.driver
parent
cf0a4210
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.clj
+31
-31
31 additions, 31 deletions
src/metabase/driver.clj
with
31 additions
and
31 deletions
src/metabase/driver.clj
+
31
−
31
View file @
3a9391d8
...
...
@@ -22,14 +22,14 @@
(
def
^
:const
available-drivers
"DB drivers that are available as a dictionary. Each key is a driver with dictionary of attributes.
ex: `:h2 {:id \"h2\" :name \"H2\"}`"
{
:h2
{
:id
"h2"
:name
"H2"
{
:h2
{
:id
"h2"
:name
"H2"
:example
"file:[filename]"
}
:postgres
{
:id
"postgres"
:name
"Postgres"
:postgres
{
:id
"postgres"
:name
"Postgres"
:example
"host=[ip address] port=5432 dbname=examples user=corvus password=******"
}
:mongo
{
:id
"mongo"
:name
"MongoDB"
:mongo
{
:id
"mongo"
:name
"MongoDB"
:example
"mongodb://password:username@127.0.0.1:27017/db-name"
}})
(
def
^
:const
class->base-type
...
...
@@ -166,20 +166,20 @@
[
query
{
:keys
[
executed_by
]
:as
options
}]
{
:pre
[(
integer?
executed_by
)]}
(
let
[
query-execution
{
:uuid
(
.toString
(
java.util.UUID/randomUUID
))
:executor_id
executed_by
:json_query
query
:query_id
nil
:version
0
:status
:starting
:error
""
:started_at
(
u/new-sql-timestamp
)
:finished_at
(
u/new-sql-timestamp
)
:running_time
0
:result_rows
0
:result_file
""
:result_data
"{}"
:raw_query
""
(
let
[
query-execution
{
:uuid
(
.toString
(
java.util.UUID/randomUUID
))
:executor_id
executed_by
:json_query
query
:query_id
nil
:version
0
:status
:starting
:error
""
:started_at
(
u/new-sql-timestamp
)
:finished_at
(
u/new-sql-timestamp
)
:running_time
0
:result_rows
0
:result_file
""
:result_data
"{}"
:raw_query
""
:additional_info
""
}]
(
let
[
query-execution
(
assoc
query-execution
:start_time_millis
(
System/currentTimeMillis
))]
(
try
...
...
@@ -197,9 +197,9 @@
(
defn
query-fail
"Save QueryExecution state and construct a failed query response"
[
query-execution
error-message
]
(
let
[
updates
{
:status
:failed
:error
error-message
:finished_at
(
u/new-sql-timestamp
)
(
let
[
updates
{
:status
:failed
:error
error-message
:finished_at
(
u/new-sql-timestamp
)
:running_time
(
-
(
System/currentTimeMillis
)
(
:start_time_millis
query-execution
))}]
;; record our query execution and format response
(
->
query-execution
...
...
@@ -207,21 +207,21 @@
(
merge
updates
)
(
save-query-execution
)
;; this is just for the response for clien
(
assoc
:error
error-message
(
assoc
:error
error-message
:row_count
0
:data
{
:rows
[]
:cols
[]
:columns
[]}))))
:data
{
:rows
[]
:cols
[]
:columns
[]}))))
(
defn
query-complete
"Save QueryExecution state and construct a completed (successful) query response"
[
query-execution
query-result
]
;; record our query execution and format response
(
->
(
u/assoc*
query-execution
:status
:completed
:finished_at
(
u/new-sql-timestamp
)
:running_time
(
-
(
System/currentTimeMillis
)
(
:start_time_millis
<>
))
:result_rows
(
get
query-result
:row_count
0
))
:status
:completed
:finished_at
(
u/new-sql-timestamp
)
:running_time
(
-
(
System/currentTimeMillis
)
(
:start_time_millis
<>
))
:result_rows
(
get
query-result
:row_count
0
))
(
dissoc
:start_time_millis
)
(
save-query-execution
)
;; at this point we've saved and we just need to massage things into our final response format
...
...
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