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
0843dafb
Unverified
Commit
0843dafb
authored
11 months ago
by
Cal Herries
Committed by
GitHub
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Realize DB transient rows in after-select hook before calling `driver.u/features` (#42744)
parent
4a6dfe40
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/models/database.clj
+1
-1
1 addition, 1 deletion
src/metabase/models/database.clj
test/metabase/models/database_test.clj
+10
-0
10 additions, 0 deletions
test/metabase/models/database_test.clj
with
11 additions
and
1 deletion
src/metabase/models/database.clj
+
1
−
1
View file @
0843dafb
...
...
@@ -181,7 +181,7 @@
(
cond->
database
;; TODO - this is only really needed for API responses. This should be a `hydrate` thing instead!
(
driver.impl/registered?
driver
)
(
assoc
:features
(
driver.u/features
driver
database
))
(
assoc
:features
(
driver.u/features
driver
(
t2.realize/realize
database
))
)
(
and
(
driver.impl/registered?
driver
)
(
:details
database
)
...
...
This diff is collapsed.
Click to expand it.
test/metabase/models/database_test.clj
+
10
−
0
View file @
0843dafb
...
...
@@ -309,6 +309,16 @@
(
is
(
partial=
{
:details
{}}
db
))))))
(
deftest
^
:parallel
after-select-driver-features-realize-db-row-test
;; This test is necessary because driver multimethods should be able to assume that the db argument is a Database
;; instance, not a transient row. Otherwise a call like `(mi/instance-of :model/Database db)` will return false
;; when it should return true.
(
testing
"Make sure selecting a database calls `driver/database-supports?` with a database instance"
(
mt/with-temp
[
Database
{
db-id
:id
}
{
:engine
(
u/qualified-name
::test
)}]
(
mt/with-dynamic-redefs
[
driver/database-supports?
(
fn
[
_
_
db
]
(
is
(
true?
(
mi/instance-of?
:model/Database
db
))))]
(
is
(
some?
(
t2/select-one-fn
:features
Database
:id
db-id
)))))))
(
deftest
hydrate-tables-test
(
is
(
=
[
"CATEGORIES"
"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