U a@sxddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z Gd d d e ej Z d S) )exc)util) coercions)elements) operators)roles) _generative) GenerativecsLeZdZdZdZdZfddZeddZedd Z ed d Z Z S) matcha[Produce a ``MATCH (X, Y) AGAINST ('TEXT')`` clause. E.g.:: from sqlalchemy import desc from sqlalchemy.dialects.mysql import match match_expr = match( users_table.c.firstname, users_table.c.lastname, against="Firstname Lastname", ) stmt = ( select(users_table) .where(match_expr.in_boolean_mode()) .order_by(desc(match_expr)) ) Would produce SQL resembling:: SELECT id, firstname, lastname FROM user WHERE MATCH(firstname, lastname) AGAINST (:param_1 IN BOOLEAN MODE) ORDER BY MATCH(firstname, lastname) AGAINST (:param_2) DESC The :func:`_mysql.match` function is a standalone version of the :meth:`_sql.ColumnElement.match` method available on all SQL expressions, as when :meth:`_expression.ColumnElement.match` is used, but allows to pass multiple columns :param cols: column expressions to match against :param against: expression to be compared towards :param in_boolean_mode: boolean, set "boolean mode" to true :param in_natural_language_mode: boolean , set "natural language" to true :param with_query_expansion: boolean, set "query expansion" to true .. versionadded:: 1.4.19 .. seealso:: :meth:`_expression.ColumnElement.match` Z mysql_matchTcs|std|dd}|s(tdttj|}tjj t j |d}d|_ t |dd|dd|ddd }|rtd d |tt|j||t j|d dS) Nzcolumns are requiredagainstzagainst is required)ZclausesFin_boolean_modein_natural_language_modewith_query_expansion)mysql_boolean_modemysql_natural_languagemysql_query_expansionzunknown arguments: %sz, ) modifiers)r ArgumentErrorpoprexpectrZExpressionElementRolerZBooleanClauseListZ_construct_rawrZcomma_opgrouprZ immutabledictjoinsuperr __init__Zmatch_op)selfcolskwr leftflags __class__eC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\dialects\mysql\expression.pyrAs>       zmatch.__init__cCs|jddi|_dS)zApply the "IN BOOLEAN MODE" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. rTNrunionrr!r!r"r eszmatch.in_boolean_modecCs|jddi|_dS)zApply the "IN NATURAL LANGUAGE MODE" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. rTNr#r%r!r!r"r os zmatch.in_natural_language_modecCs|jddi|_dS)zApply the "WITH QUERY EXPANSION" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. rTNr#r%r!r!r"rzszmatch.with_query_expansion) __name__ __module__ __qualname____doc__Z__visit_name__Z inherit_cacherrr r r __classcell__r!r!rr"r s1 $  r N) rrZsqlrrrrZsql.baserr ZBinaryExpressionr r!r!r!r"s