Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use importlib_metadata; add namespace for mariadb
The ``importlib_metadata`` library is used to scan for setuptools entrypoints rather than pkg_resources. as importlib_metadata is a small library that is included as of Python 3.8, the compatibility library is installed as a dependency for Python versions older than 3.8. Unfortunately setuptools "attr:" is broken because it tries to import the module; seems like this is fixed as part of pypa/setuptools#1753 however this is too recent to rely upon for now. Added a new dialect token "mariadb" that may be used in place of "mysql" in the :func:`_sa.create_engine` URL. This will deliver a MariaDB dialect subclass of the MySQLDialect in use that forces the "is_mariadb" flag to True. The dialect will raise an error if a server version string that does not indicate MariaDB in use is received. This is useful for MariaDB-specific testing scenarios as well as to support applications that are hardcoding to MariaDB-only concepts. As MariaDB and MySQL featuresets and usage patterns continue to diverge, this pattern may become more prominent. Fixes: #5400 Fixes: #5496 Change-Id: I330815ebe572b6a9818377da56621397335fa702
- Loading branch information
Showing
13 changed files
with
239 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. change:: | ||
:tags: change, installation | ||
:tickets: 5400 | ||
|
||
The ``importlib_metadata`` library is used to scan for setuptools | ||
entrypoints rather than pkg_resources. as importlib_metadata is a small | ||
library that is included as of Python 3.8, the compatibility library is | ||
installed as a dependency for Python versions older than 3.8. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.. change:: | ||
:tags: usecase, mysql | ||
:tickets: 5496 | ||
|
||
Added a new dialect token "mariadb" that may be used in place of "mysql" in | ||
the :func:`_sa.create_engine` URL. This will deliver a MariaDB dialect | ||
subclass of the MySQLDialect in use that forces the "is_mariadb" flag to | ||
True. The dialect will raise an error if a server version string that does | ||
not indicate MariaDB in use is received. This is useful for | ||
MariaDB-specific testing scenarios as well as to support applications that | ||
are hardcoding to MariaDB-only concepts. As MariaDB and MySQL featuresets | ||
and usage patterns continue to diverge, this pattern may become more | ||
prominent. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from .base import MySQLDialect | ||
|
||
|
||
class MariaDBDialect(MySQLDialect): | ||
is_mariadb = True | ||
|
||
|
||
def loader(driver): | ||
driver_mod = __import__( | ||
"sqlalchemy.dialects.mysql.%s" % driver | ||
).dialects.mysql | ||
driver_cls = getattr(driver_mod, driver).dialect | ||
|
||
return type( | ||
"MariaDBDialect_%s" % driver, (MariaDBDialect, driver_cls,), {} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.