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
f21baa7c
Unverified
Commit
f21baa7c
authored
1 year ago
by
Braden Shepherdson
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[MLv2] Add `:is_source_table` to the display info `table` field (#30003)
Fixes #29989
parent
6a0eb5c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/lib/metadata/calculation.cljc
+8
-1
8 additions, 1 deletion
src/metabase/lib/metadata/calculation.cljc
src/metabase/lib/util.cljc
+5
-0
5 additions, 0 deletions
src/metabase/lib/util.cljc
test/metabase/lib/order_by_test.cljc
+15
-8
15 additions, 8 deletions
test/metabase/lib/order_by_test.cljc
with
28 additions
and
9 deletions
src/metabase/lib/metadata/calculation.cljc
+
8
−
1
View file @
f21baa7c
...
...
@@ -234,7 +234,9 @@
[
:is_calculated
{
:optional
true
}
[
:maybe
:boolean
]]
;; if this is a Column, is it an implicitly joinable one? I.e. is it from a different table that we have not
;; already joined, but could implicitly join against?
[
:is_implicitly_joinable
{
:optional
true
}
[
:maybe
:boolean
]]])
[
:is_implicitly_joinable
{
:optional
true
}
[
:maybe
:boolean
]]
;; For the `:table` field of a Column, is this the source table, or a joined table?
[
:is_source_table
{
:optional
true
}
[
:maybe
:boolean
]]])
(
mu/defn
display-info
:-
::display-info
"Given some sort of Cljs object, return a map with the info you'd need to implement UI for it. This is mostly meant to
...
...
@@ -272,3 +274,8 @@
(
defmethod
display-info-method
:default
[
query
stage-number
x
]
(
default-display-info
query
stage-number
x
))
(
defmethod
display-info-method
:metadata/table
[
query
stage-number
table
]
(
merge
(
default-display-info
query
stage-number
table
)
{
:is_source_table
(
=
(
lib.util/source-table
query
)
(
:id
table
))}))
This diff is collapsed.
Click to expand it.
src/metabase/lib/util.cljc
+
5
−
0
View file @
f21baa7c
...
...
@@ -375,3 +375,8 @@
(
when
(
string?
table-id
)
(
when-let
[[
_match
card-id-str
]
(
re-find
#
"^card__(\d+)$"
table-id
)]
(
parse-long
card-id-str
))))
(
mu/defn
source-table
:-
[
:maybe
::lib.schema.id/table
]
"If this query has a `:source-table`, return it."
[
query
]
(
->
query
:stages
first
:source-table
))
This diff is collapsed.
Click to expand it.
test/metabase/lib/order_by_test.cljc
+
15
−
8
View file @
f21baa7c
...
...
@@ -628,20 +628,27 @@
(
let
[
query
(
lib/query-for-table-name
meta/metadata-provider
"VENUES"
)]
(
is
(
=?
[{
:semantic_type
:type/PK
:is_calculated
false
:table
{
:name
"VENUES"
,
:display_name
"Venues"
}
:table
{
:name
"VENUES"
,
:display_name
"Venues"
:is_source_table
true
}
:name
"ID"
:is_from_previous_stage
false
:is_implicitly_joinable
false
:effective_type
:type/BigInteger
:is_from_join
false
:display_name
"ID"
}
{
:display_name
"Name"
}
{
:display_name
"Category ID"
}
{
:display_name
"Latitude"
}
{
:display_name
"Longitude"
}
{
:display_name
"Price"
}
{
:display_name
"ID"
}
{
:display_name
"Name"
}]
{
:display_name
"Name"
:table
{
:is_source_table
true
}}
{
:display_name
"Category ID"
:table
{
:is_source_table
true
}}
{
:display_name
"Latitude"
:table
{
:is_source_table
true
}}
{
:display_name
"Longitude"
:table
{
:is_source_table
true
}}
{
:display_name
"Price"
:table
{
:is_source_table
true
}}
{
:display_name
"ID"
:table
{
:name
"CATEGORIES"
:display_name
"Categories"
:is_source_table
false
}}
{
:display_name
"Name"
:table
{
:name
"CATEGORIES"
:display_name
"Categories"
:is_source_table
false
}}]
(
for
[
col
(
lib/orderable-columns
query
)]
(
lib/display-info
query
col
))))))
...
...
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