|
6 | 6 |
|
7 | 7 | from functools import cached_property |
8 | 8 |
|
| 9 | +import MySQLdb as Database |
| 10 | +from MySQLdb.constants import CLIENT, FIELD_TYPE |
| 11 | +from MySQLdb.converters import conversions |
| 12 | + |
9 | 13 | from plain.exceptions import ImproperlyConfigured |
10 | 14 | from plain.models.backends import utils as backend_utils |
11 | 15 | from plain.models.backends.base.base import BaseDatabaseWrapper |
12 | 16 | from plain.models.db import IntegrityError |
13 | 17 | from plain.utils.regex_helper import _lazy_re_compile |
14 | 18 |
|
15 | | -try: |
16 | | - import MySQLdb as Database |
17 | | -except ImportError as err: |
18 | | - raise ImproperlyConfigured( |
19 | | - "Error loading MySQLdb module.\nDid you install mysqlclient?" |
20 | | - ) from err |
21 | | - |
22 | | -from MySQLdb.constants import CLIENT, FIELD_TYPE |
23 | | -from MySQLdb.converters import conversions |
24 | | - |
25 | | -# Some of these import MySQLdb, so import them after checking if it's installed. |
26 | 19 | from .client import DatabaseClient |
27 | 20 | from .creation import DatabaseCreation |
28 | 21 | from .features import DatabaseFeatures |
|
31 | 24 | from .schema import DatabaseSchemaEditor |
32 | 25 | from .validation import DatabaseValidation |
33 | 26 |
|
34 | | -version = Database.version_info |
35 | | -if version < (1, 4, 3): |
36 | | - raise ImproperlyConfigured( |
37 | | - f"mysqlclient 1.4.3 or newer is required; you have {Database.__version__}." |
38 | | - ) |
39 | | - |
40 | | - |
41 | 27 | # MySQLdb returns TIME columns as timedelta -- they are more like timedelta in |
42 | 28 | # terms of actual behavior as they are signed and include days -- and Plain |
43 | 29 | # expects time. |
|
0 commit comments