File: //usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/mysql/__pycache__/dml.cpython-310.pyc
o
���gX � @ sX d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z d d
l
mZ d dl
mZ d dl
mZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ dZ d"dd�Z!G dd� de�ZG dd � d e�Z"e eeef eee#ef eeef f Z$d!S )#� )�annotations)�Any)�Dict)�List)�Mapping)�Optional)�Tuple)�Union� )�exc)�util)�_DMLTableArgument)�_exclusive_against)�_generative)�ColumnCollection)�ReadOnlyColumnCollection��Insert)�
ClauseElement)�KeyedColumnElement)�alias)�NamedFromClause)�Self)r �insert�tabler
�returnr c C s t | �S )a( Construct a MySQL/MariaDB-specific variant :class:`_mysql.Insert`
construct.
.. container:: inherited_member
The :func:`sqlalchemy.dialects.mysql.insert` function creates
a :class:`sqlalchemy.dialects.mysql.Insert`. This class is based
on the dialect-agnostic :class:`_sql.Insert` construct which may
be constructed using the :func:`_sql.insert` function in
SQLAlchemy Core.
The :class:`_mysql.Insert` construct includes additional methods
:meth:`_mysql.Insert.on_duplicate_key_update`.
r )r � r �H/usr/local/lib/python3.10/dist-packages/sqlalchemy/dialects/mysql/dml.pyr # s r c @ sT e Zd ZdZdZdZeddd��Zej dd d
��Z
eedddid
�ddd���Z
dS )r a MySQL-specific implementation of INSERT.
Adds methods for MySQL-specific syntaxes such as ON DUPLICATE KEY UPDATE.
The :class:`~.mysql.Insert` object is created using the
:func:`sqlalchemy.dialects.mysql.insert` function.
.. versionadded:: 1.2
�mysqlFr �6ReadOnlyColumnCollection[str, KeyedColumnElement[Any]]c C s | j jS )a� Provide the "inserted" namespace for an ON DUPLICATE KEY UPDATE
statement
MySQL's ON DUPLICATE KEY UPDATE clause allows reference to the row
that would be inserted, via a special function called ``VALUES()``.
This attribute provides all columns in this row to be referenceable
such that they will render within a ``VALUES()`` function inside the
ON DUPLICATE KEY UPDATE clause. The attribute is named ``.inserted``
so as not to conflict with the existing
:meth:`_expression.Insert.values` method.
.. tip:: The :attr:`_mysql.Insert.inserted` attribute is an instance
of :class:`_expression.ColumnCollection`, which provides an
interface the same as that of the :attr:`_schema.Table.c`
collection described at :ref:`metadata_tables_and_columns`.
With this collection, ordinary names are accessible like attributes
(e.g. ``stmt.inserted.some_column``), but special names and
dictionary method names should be accessed using indexed access,
such as ``stmt.inserted["column name"]`` or
``stmt.inserted["values"]``. See the docstring for
:class:`_expression.ColumnCollection` for further examples.
.. seealso::
:ref:`mysql_insert_on_duplicate_key_update` - example of how
to use :attr:`_expression.Insert.inserted`
)�inserted_alias�columns��selfr r r �insertedE s zInsert.insertedr c C s t | jdd�S )Nr$ )�name)r r r"