]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix way
authorAnton Kovalevich <kai3341@gmail.com>
Sat, 5 Jun 2021 01:43:02 +0000 (04:43 +0300)
committerAnton Kovalevich <kai3341@gmail.com>
Sat, 5 Jun 2021 01:43:02 +0000 (04:43 +0300)
lib/sqlalchemy/dialects/mysql/__init__.py
lib/sqlalchemy/dialects/mysql/expression.py
lib/sqlalchemy/sql/elements.py

index 4db05984c25257da90088427cc526f8fd2e758b7..5ba1eca6b16dfba0de1bc41f9b106058508c412d 100644 (file)
@@ -49,7 +49,7 @@ from .base import VARCHAR
 from .base import YEAR
 from .dml import Insert
 from .dml import insert
-from .expression import match
+from .expression import match_
 from ...util import compat
 
 if compat.py3k:
@@ -100,5 +100,5 @@ __all__ = (
     "dialect",
     "insert",
     "Insert",
-    "match",
+    "match_",
 )
index 6af57baaed59e4097772ff7a7c22cbee5d7286e4..2a676a32abedd7b8d32c6160b8820e2599d2de4d 100644 (file)
@@ -2,9 +2,10 @@ from functools import wraps
 
 from sqlalchemy import exc
 from sqlalchemy.ext.compiler import compiles
+from sqlalchemy.sql import operators
 from sqlalchemy.sql.elements import (
     ColumnElement,
-    ClauseElementBatch,
+    BooleanClauseList,
 )
 
 
@@ -16,7 +17,7 @@ def property_enables_flag(flag_name):
             new_flags = self.flags.copy()
             new_flags[flag_name] = True
 
-            return match(
+            return match_(
                 self.clause,
                 against=self.against,
                 flags=new_flags,
@@ -26,7 +27,7 @@ def property_enables_flag(flag_name):
     return wrapper
 
 
-class match(ColumnElement):
+class match_(ColumnElement):
     """Produce a ``MATCH (X, Y) AGAINST ('TEXT')`` clause.
 
     E.g.::
@@ -113,23 +114,29 @@ class match(ColumnElement):
         elif clauselist_len == 1:
             self.clause = clauselist[0]
         else:
-            self.clause = ClauseElementBatch(*clauselist, group=False)
+            clause = BooleanClauseList._construct_raw(
+                operators.comma_op,
+                clauses=clauselist,
+            )
+            clause.group = False
+            self.clause = clause
 
         self.against = against
         self.flags = flags or self.default_flags.copy()
 
     @property_enables_flag('mysql_boolean_mode')
-    def in_boolean_mode(self): ...
+    def in_boolean_mode(self): pass
 
     @property_enables_flag('mysql_natural_language')
-    def in_natural_language_mode(self): ...
+    def in_natural_language_mode(self): pass
 
     @property_enables_flag('mysql_query_expansion')
-    def with_query_expansion(self): ...
+    def with_query_expansion(self): pass
+
 
 
-@compiles(match, "mysql")
-def visit_match(element: match, compiler, **kw):
+@compiles(match_, "mysql")
+def visit_match(element, compiler, **kw):
     target = element.clause.match(
         element.against,
         **element.flags
index 0c6fc51c275639574085ecfa059e6e343c7fba41..20c3e899114467b2f2054ad207b14d5612331f55 100644 (file)
@@ -2226,15 +2226,6 @@ class ClauseList(
             return self
 
 
-class ClauseElementBatch(ClauseList, ColumnElement):
-    """Describe a batch of clauses, separated by an operator, but processing
-    as single column.
-
-    By default, is comma-separated, such as a column listing.
-
-    """
-
-
 class BooleanClauseList(ClauseList, ColumnElement):
     __visit_name__ = "clauselist"
     inherit_cache = True