]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Convert _supports_notnull_generated_columns into property
authorGeorg Wicke-Arndt <georg.wicke@rwth-aachen.de>
Sat, 13 Jan 2024 23:19:06 +0000 (00:19 +0100)
committerGeorg Wicke-Arndt <georg.wicke@rwth-aachen.de>
Sat, 13 Jan 2024 23:19:06 +0000 (00:19 +0100)
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/mysql/test_reflection.py

index fb1beca04824de56b5e6d90a9a48969ac5df6c64..c470c3af91cf7835a65553c1823d803a720b2acd 100644 (file)
@@ -2446,9 +2446,6 @@ class MySQLDialect(default.DefaultDialect):
     supports_for_update_of = False  # default for MySQL ...
     # ... may be updated to True for MySQL 8+ in initialize()
 
-    supports_notnull_generated_columns = False  # Only available ...
-    # ... in MySQL 5.7+
-
     _requires_alias_for_on_duplicate_key = False  # Only available ...
     # ... in MySQL 8+
 
@@ -2849,10 +2846,6 @@ class MySQLDialect(default.DefaultDialect):
             self._is_mysql and self.server_version_info >= (8,)
         )
 
-        self.supports_notnull_generated_columns = (
-            self._is_mysql and self.server_version_info >= (5, 7)
-        )
-
         self._needs_correct_for_88718_96365 = (
             not self.is_mariadb and self.server_version_info >= (8,)
         )
@@ -2910,6 +2903,10 @@ class MySQLDialect(default.DefaultDialect):
             10,
             2,
         )
+    
+    @property
+    def _supports_notnull_generated_columns(self):
+        return self._is_mysql and self.server_version_info >= (5, 7)
 
     @reflection.cache
     def get_schema_names(self, connection, **kw):
index d4b34b2db2c07747602b561f81a041a5cbf1551b..02d72f370ddf1f9bd48182404e3cfc5e1a81406f 100644 (file)
@@ -792,7 +792,7 @@ class ReflectionTest(fixtures.TestBase, AssertsCompiledSQL):
             ["u TIMESTAMP DEFAULT CURRENT_TIMESTAMP"],
             ["v INTEGER GENERATED ALWAYS AS (4711) VIRTUAL NOT NULL"],
         ]
-        if connection.dialect.supports_notnull_generated_columns:
+        if connection.dialect._supports_notnull_generated_columns:
             test_cases.append(
                 ["v INTEGER GENERATED ALWAYS AS (4711) VIRTUAL NOT NULL"])