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
1cde1ffc
Unverified
Commit
1cde1ffc
authored
7 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Fix ineligible source queries coming back from API
parent
d13ab46c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/database.clj
+2
-2
2 additions, 2 deletions
src/metabase/api/database.clj
test/metabase/api/database_test.clj
+19
-2
19 additions, 2 deletions
test/metabase/api/database_test.clj
with
21 additions
and
4 deletions
src/metabase/api/database.clj
+
2
−
2
View file @
1cde1ffc
...
...
@@ -64,8 +64,8 @@
(
defn-
card-database-supports-nested-queries?
[{{
database-id
:database
}
:dataset_query,
:as
card
}]
(
when
database-id
(
when-let
[
driver
(
driver/database-id->driver
database-id
)]
(
driver/driver-supports?
driver
:nested-queries
)
(
mi/can-read?
card
))))
(
and
(
driver/driver-supports?
driver
:nested-queries
)
(
mi/can-read?
card
))))
)
(
defn-
card-has-ambiguous-columns?
"We know a card has ambiguous columns if any of the columns that come back end in `_2` (etc.) because that's what
...
...
This diff is collapsed.
Click to expand it.
test/metabase/api/database_test.clj
+
19
−
2
View file @
1cde1ffc
...
...
@@ -405,7 +405,8 @@
;; run the Cards which will populate their result_metadata columns
(
doseq
[
card
[
stamp-card
coin-card
]]
((
user->client
:crowberto
)
:post
200
(
format
"card/%d/query"
(
u/get-id
card
))))
;; Now fetch the database list. The 'Saved Questions' DB should be last on the list. Cards should have their Collection name as their Schema
;; Now fetch the database list. The 'Saved Questions' DB should be last on the list. Cards should have their
;; Collection name as their Schema
(
last
((
user->client
:crowberto
)
:get
200
"database"
:include_cards
true
))))
(
defn-
fetch-virtual-database
[]
...
...
@@ -420,8 +421,24 @@
(
virtual-table-for-card
ok-card
))
(
fetch-virtual-database
))
;; make sure that GET /api/database/include_cards=true removes Cards that belong to a driver that doesn't support
;; nested queries
(
tt/expect-with-temp
[
Database
[
druid-db
{
:engine
:druid,
:details
{}}]
Card
[
druid-card
{
:name
"Druid Card"
:dataset_query
{
:database
(
u/get-id
druid-db
)
:type
:native
:native
{
:query
"[DRUID QUERY GOES HERE]"
}}
:result_metadata
[{
:name
"sparrows"
}]
:database_id
(
u/get-id
druid-db
)}]
Card
[
ok-card
(
assoc
(
card-with-native-query
"OK Card"
)
:result_metadata
[{
:name
"finches"
}])]]
(
saved-questions-virtual-db
(
virtual-table-for-card
ok-card
))
(
fetch-virtual-database
))
;; make sure that GET /api/database?include_cards=true removes Cards that use cumulative-sum and cumulative-count aggregations
;; make sure that GET /api/database?include_cards=true removes Cards that use cumulative-sum and cumulative-count
;; aggregations
(
defn-
ok-mbql-card
[]
(
assoc
(
card-with-mbql-query
"OK Card"
:source-table
(
data/id
:checkins
))
...
...
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