Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Classe « Insert »

Méthode sqlalchemy.Insert.from_select

Signature de la méthode from_select

def from_select(self, names: 'Sequence[_DMLColumnArgument]', select: 'Selectable', include_defaults: 'bool' = True) -> 'Self' 

Description

help(Insert.from_select)

Return a new :class:`_expression.Insert` construct which represents
an ``INSERT...FROM SELECT`` statement.

e.g.::

    sel = select(table1.c.a, table1.c.b).where(table1.c.c > 5)
    ins = table2.insert().from_select(["a", "b"], sel)

:param names: a sequence of string column names or
 :class:`_schema.Column`
 objects representing the target columns.
:param select: a :func:`_expression.select` construct,
 :class:`_expression.FromClause`
 or other construct which resolves into a
 :class:`_expression.FromClause`,
 such as an ORM :class:`_query.Query` object, etc.  The order of
 columns returned from this FROM clause should correspond to the
 order of columns sent as the ``names`` parameter;  while this
 is not checked before passing along to the database, the database
 would normally raise an exception if these column lists don't
 correspond.
:param include_defaults: if True, non-server default values and
 SQL expressions as specified on :class:`_schema.Column` objects
 (as documented in :ref:`metadata_defaults_toplevel`) not
 otherwise specified in the list of names will be rendered
 into the INSERT and SELECT statements, so that these values are also
 included in the data to be inserted.

 .. note:: A Python-side default that uses a Python callable function
    will only be invoked **once** for the whole statement, and **not
    per row**.



Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé