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
94a02dc4
Commit
94a02dc4
authored
6 years ago
by
Ryan Senior
Committed by
Ryan Senior
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Refactor `/api/table/query_metadata` route logic to a function
parent
de107b76
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/api/table.clj
+15
-10
15 additions, 10 deletions
src/metabase/api/table.clj
with
15 additions
and
10 deletions
src/metabase/api/table.clj
+
15
−
10
View file @
94a02dc4
...
...
@@ -212,16 +212,11 @@
(
update
field
:values
fv/field-values->pairs
)
field
)))))
(
api/defendpoint
GET
"/:id/query_metadata"
"Get metadata about a `Table` us eful for running queries.
Returns DB, fields, field FKs, and field values.
By passing `include_sensitive_fields=true`, information *about* sensitive `Fields` will be returned; in no case will
any of its corresponding values be returned. (This option is provided for use in the Admin Edit Metadata page)."
[
id
include_sensitive_fields
]
{
include_sensitive_fields
(
s/maybe
su/BooleanString
)}
(
let
[
table
(
api/read-check
Table
id
)
driver
(
driver/database-id->driver
(
:db_id
table
))]
(
defn
fetch-query-metadata
"Returns the query metadata used to power the query builder for the given table `table-or-table-id`"
[
table
include_sensitive_fields
]
(
api/read-check
table
)
(
let
[
driver
(
driver/database-id->driver
(
:db_id
table
))]
(
->
table
(
hydrate
:db
[
:fields
[
:target
:has_field_values
]
:dimensions
:has_field_values
]
:segments
:metrics
)
(
m/dissoc-in
[
:db
:details
])
...
...
@@ -234,6 +229,16 @@
(
partial
filter
(
fn
[{
:keys
[
visibility_type
]}]
(
not=
(
keyword
visibility_type
)
:sensitive
))))))))
(
api/defendpoint
GET
"/:id/query_metadata"
"Get metadata about a `Table` useful for running queries.
Returns DB, fields, field FKs, and field values.
By passing `include_sensitive_fields=true`, information *about* sensitive `Fields` will be returned; in no case will
any of its corresponding values be returned. (This option is provided for use in the Admin Edit Metadata page)."
[
id
include_sensitive_fields
]
{
include_sensitive_fields
(
s/maybe
su/BooleanString
)}
(
fetch-query-metadata
(
Table
id
)
include_sensitive_fields
))
(
defn-
card-result-metadata->virtual-fields
"Return a sequence of 'virtual' fields metadata for the 'virtual' table for a Card in the Saved Questions 'virtual'
database."
...
...
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