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
e0cded18
Unverified
Commit
e0cded18
authored
6 years ago
by
Sameer Al-Sakran
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #7548 from metabase/xray-fallback-to-generictable
xray: add fallback to GenericTable
parents
7412d488
cda99bf2
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/automagic_dashboards/core.clj
+2
-4
2 additions, 4 deletions
src/metabase/automagic_dashboards/core.clj
test/metabase/automagic_dashboards/core_test.clj
+17
-20
17 additions, 20 deletions
test/metabase/automagic_dashboards/core_test.clj
with
19 additions
and
24 deletions
src/metabase/automagic_dashboards/core.clj
+
2
−
4
View file @
e0cded18
...
...
@@ -428,7 +428,7 @@
Most specific is defined as entity type specification the longest ancestor
chain."
[
rules
{
:keys
[
source
entity
]}]
(
let
[
table-type
(
:entity_type
source
)]
(
let
[
table-type
(
or
(
:entity_type
source
)
:entity/GenericTable
)
]
(
->>
rules
(
filter
(
fn
[{
:keys
[
applies_to
]}]
(
let
[[
entity-type
field-type
]
applies_to
]
...
...
@@ -768,9 +768,7 @@
(
let
[
rules
(
rules/load-rules
"table"
)]
(
->>
(
apply
db/select
Table
(
cond->
[
:db_id
(
u/get-id
database
)
:visibility_type
nil
:entity_type
[
:not=
nil
]]
; only consider tables that have alredy
; been analyzed
:visibility_type
nil
]
schema
(
concat
[
:schema
schema
])))
(
filter
mi/can-read?
)
(
map
enhanced-table-stats
)
...
...
This diff is collapsed.
Click to expand it.
test/metabase/automagic_dashboards/core_test.clj
+
17
−
20
View file @
e0cded18
...
...
@@ -53,6 +53,17 @@
(
#
'magic/matching-rules
(
rules/load-rules
"table"
))
(
map
(
comp
first
:applies_to
))))
;; Test fallback to GenericTable
(
expect
[
:entity/GenericTable
:entity/*
]
(
->>
(
->
(
data/id
:users
)
Table
(
assoc
:entity_type
nil
)
(
#
'magic/->root
))
(
#
'magic/matching-rules
(
rules/load-rules
"table"
))
(
map
(
comp
first
:applies_to
))))
(
defn-
collect-urls
[
dashboard
]
(
->>
dashboard
...
...
@@ -195,34 +206,20 @@
(
expect
[
true
true
]
(
tt/with-temp*
[
Table
[{
table-id
:id
}]]
(
with-rasta
(
with-dashboard-cleanup
(
let
[
table
(
Table
table-id
)
not-analyzed-result
(
automagic-analysis
table
{})
analyzed-result
(
->
table
(
assoc
:entity_type
:entity/GenericTable
)
(
automagic-analysis
{}))]
[(
nil?
not-analyzed-result
)
(
some?
analyzed-result
)])))))
3
(
with-rasta
(
->>
(
Database
(
data/id
))
candidate-tables
first
:tables
count
)))
;; /candidates should work with unanalyzed tables
(
expect
1
(
tt/with-temp*
[
Database
[{
db-id
:id
}]
Table
[{
table-id
:id
}
{
:db_id
db-id
}]
Field
[{}
{
:table_id
table-id
}]
Field
[{}
{
:table_id
table-id
}]]
(
with-rasta
(
with-dashboard-cleanup
(
let
[
database
(
Database
db-id
)
not-analyzed-count
(
count
(
candidate-tables
database
))]
(
db/update!
Table
table-id
:entity_type
:entity/GenericTable
)
(
=
(
inc
not-analyzed-count
)
(
count
(
candidate-tables
database
))))))))
(
expect
3
(
with-rasta
(
->>
(
Database
(
data/id
))
candidate-tables
first
:tables
count
)))
(
count
(
candidate-tables
(
Database
db-id
)))))))
;; Identity
...
...
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