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
d991147b
Unverified
Commit
d991147b
authored
5 years ago
by
Cam Saul
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Warn when connecting to unsupported MySQL versions (#11767)
parent
0d174622
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/driver/mysql.clj
+25
-2
25 additions, 2 deletions
src/metabase/driver/mysql.clj
with
25 additions
and
2 deletions
src/metabase/driver/mysql.clj
+
25
−
2
View file @
d991147b
...
...
@@ -7,8 +7,10 @@
[
clojure.tools.logging
:as
log
]
[
honeysql.core
:as
hsql
]
[
java-time
:as
t
]
[
metabase
[
driver
:as
driver
]
[
util
:as
u
]]
[
metabase.db.spec
:as
dbspec
]
[
metabase.driver
:as
driver
]
[
metabase.driver.common
:as
driver.common
]
[
metabase.driver.sql-jdbc
[
common
:as
sql-jdbc.common
]
...
...
@@ -22,7 +24,7 @@
[
honeysql-extensions
:as
hx
]
[
i18n
:refer
[
trs
]]
[
ssh
:as
ssh
]])
(
:import
[
java.sql
ResultSet
ResultSetMetaData
Types
]
(
:import
[
java.sql
DatabaseMetaData
ResultSet
ResultSetMetaData
Types
]
[
java.time
LocalDateTime
OffsetDateTime
OffsetTime
ZonedDateTime
]))
(
driver/register!
:mysql,
:parent
:sql-jdbc
)
...
...
@@ -34,6 +36,27 @@
;;; | metabase.driver impls |
;;; +----------------------------------------------------------------------------------------------------------------+
(
defn-
db-version
[
^
DatabaseMetaData
metadata
]
(
Double/parseDouble
(
format
"%d.%d"
(
.getDatabaseMajorVersion
metadata
)
(
.getDatabaseMinorVersion
metadata
))))
(
defn-
warn-on-unsupported-versions
[
driver
details
]
(
let
[
jdbc-spec
(
sql-jdbc.conn/details->connection-spec-for-testing-connection
driver
details
)]
(
jdbc/with-db-metadata
[
metadata
jdbc-spec
]
(
when
(
<
(
db-version
metadata
)
5.7
)
(
log/warn
(
u/format-color
'red
(
str
(
trs
"WARNING: Metabase only officially supports MySQL/MariaDB 5.7 and above."
)
" "
(
trs
"All Metabase features may not work properly when using an unsupported version of MySQL."
))))))))
(
defmethod
driver/can-connect?
:mysql
[
driver
details
]
;; delegate to parent method to check whether we can connect; if so, check if it's an unsupported version and issue
;; a warning if it is
(
when
((
get-method
driver/can-connect?
:sql-jdbc
)
driver
details
)
(
warn-on-unsupported-versions
driver
details
)
true
))
(
defmethod
driver/supports?
[
:mysql
:full-join
]
[
_
_
]
false
)
(
defmethod
driver/connection-properties
:mysql
...
...
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