관리-도구
편집 파일: expression.cpython-38.pyc
U -?�f � @ s� d dl mZ d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z d dlm Z d d lmZ G d d� de ej �ZdS ) � )�exc)�util)� coercions)�elements)� operators)�roles)�_generative)� Generative)�Selfc s^ e Zd ZdZdZdZ� fdd�Zeed�dd��Z eed�d d ��Z eed�dd��Z� ZS ) �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` Zmysql_matchTc s� |st �d��|�dd �}|d kr,t �d��t�tj|�}tjj t j|d�}d|_t �|�dd�|�dd�|�dd�d ��}|r�t �d d�|� ��t� j||t j|d� d S ) Nzcolumns are required�againstzagainst is required)ZclausesF�in_boolean_mode�in_natural_language_mode�with_query_expansion)�mysql_boolean_mode�mysql_natural_language�mysql_query_expansionzunknown arguments: %sz, )� modifiers)r � ArgumentError�popr �expectr ZExpressionElementRoler ZBooleanClauseListZ_construct_rawr Zcomma_op�groupr Z immutabledict�join�super�__init__Zmatch_op)�self�cols�kwr �left�flags�� __class__� �T/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/dialects/mysql/expression.pyr K s4 �� � �� zmatch.__init__)�returnc C s | j �ddi�| _ | S )z�Apply the "IN BOOLEAN MODE" modifier to the MATCH expression. :return: a new :class:`_mysql.match` instance with modifications applied. r T�r �union�r r"