Skip to content

Commit

Permalink
[DOP-13851] Update MySQL package to 8.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed May 23, 2024
1 parent 22818a5 commit 300f5ad
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/data/mysql/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ latest: &latest

matrix:
small:
- mysql-version: 8.3.0
- mysql-version: 8.4.0
<<: *max
full:
# Min supported version by JDBC driver is 5.7
- mysql-version: 5.7.6
<<: *min
# Max supported version by JDBC driver is 8.3
- mysql-version: 8.3.0
- mysql-version: 8.4.0
<<: *max
nightly:
- mysql-version: 5.7.6
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog/next_release/253.feature.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
:class:`MySQL` connection now uses MySQL JDBC driver ``8.3.0``, upgraded from ``8.0.33``, and supports passing custom versions: ``MySQL.get_packages(package_version=...)``.
:class:`MySQL` connection now uses MySQL JDBC driver ``8.4.0``, upgraded from ``8.0.33``, and supports passing custom versions: ``MySQL.get_packages(package_version=...)``.
2 changes: 1 addition & 1 deletion docs/connection/db_connection/mysql/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Prerequisites
Version Compatibility
---------------------

* MySQL server versions: 5.7, 8.0
* MySQL server versions: 5.7 - 8.4
* Spark versions: 2.3.x - 3.5.x
* Java versions: 8 - 20

Expand Down
10 changes: 5 additions & 5 deletions onetl/connection/db_connection/mysql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Config:
class MySQL(JDBCConnection):
"""MySQL JDBC connection. |support_hooks|
Based on Maven package ``com.mysql:mysql-connector-j:8.0.33``
(`official MySQL JDBC driver <https://dev.mysql.com/downloads/connector/j/8.0.html>`_).
Based on Maven package `com.mysql:mysql-connector-j:8.4.0 <https://mvnrepository.com/artifact/com.mysql/mysql-connector-j/8.4.0>`_
(`official MySQL JDBC driver <https://dev.mysql.com/downloads/connector/j/8.4.html>`_).
.. warning::
Expand Down Expand Up @@ -125,7 +125,7 @@ def get_packages(cls, package_version: str | None = None) -> list[str]:
Parameters
----------
package_version : str, optional
Specifies the version of the MySQL JDBC driver to use. Defaults to ``8.3.0``.
Specifies the version of the MySQL JDBC driver to use. Defaults to ``8.4.0``.
Examples
--------
Expand All @@ -138,7 +138,7 @@ def get_packages(cls, package_version: str | None = None) -> list[str]:
# specify a custom package version
MySQL.get_packages(package_version="8.2.0")
"""
default_version = "8.3.0"
default_version = "8.4.0"
version = Version(package_version or default_version).min_digits(3)

return [f"com.mysql:mysql-connector-j:{version}"]
Expand All @@ -148,7 +148,7 @@ def package(cls) -> str:
"""Get package name to be downloaded by Spark."""
msg = "`MySQL.package` will be removed in 1.0.0, use `MySQL.get_packages()` instead"
warnings.warn(msg, UserWarning, stacklevel=3)
return "com.mysql:mysql-connector-j:8.3.0"
return "com.mysql:mysql-connector-j:8.4.0"

@property
def jdbc_url(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions tests/tests_unit/tests_db_connection_unit/test_mysql_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ def test_mysql_class_attributes():
def test_mysql_package():
warning_msg = re.escape("will be removed in 1.0.0, use `MySQL.get_packages()` instead")
with pytest.warns(UserWarning, match=warning_msg):
assert MySQL.package == "com.mysql:mysql-connector-j:8.3.0"
assert MySQL.package == "com.mysql:mysql-connector-j:8.4.0"


@pytest.mark.parametrize(
"package_version, expected_packages",
[
(None, ["com.mysql:mysql-connector-j:8.3.0"]),
("8.3.0", ["com.mysql:mysql-connector-j:8.3.0"]),
(None, ["com.mysql:mysql-connector-j:8.4.0"]),
("8.4.0", ["com.mysql:mysql-connector-j:8.4.0"]),
("8.1.0", ["com.mysql:mysql-connector-j:8.1.0"]),
("8.0.33", ["com.mysql:mysql-connector-j:8.0.33"]),
],
Expand Down

0 comments on commit 300f5ad

Please sign in to comment.