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 ? Programmation Python
Les compléments
Voir le programme détaillé
Classe « Table »

Méthode sqlalchemy.Table.append_column

Signature de la méthode append_column

def append_column(self, column: 'ColumnClause[Any]', replace_existing: 'bool' = False) -> 'None' 

Description

help(Table.append_column)

Append a :class:`_schema.Column` to this :class:`_schema.Table`.

The "key" of the newly added :class:`_schema.Column`, i.e. the
value of its ``.key`` attribute, will then be available
in the ``.c`` collection of this :class:`_schema.Table`, and the
column definition will be included in any CREATE TABLE, SELECT,
UPDATE, etc. statements generated from this :class:`_schema.Table`
construct.

Note that this does **not** change the definition of the table
as it exists within any underlying database, assuming that
table has already been created in the database.   Relational
databases support the addition of columns to existing tables
using the SQL ALTER command, which would need to be
emitted for an already-existing table that doesn't contain
the newly added column.

:param replace_existing: When ``True``, allows replacing existing
    columns. When ``False``, the default, an warning will be raised
    if a column with the same ``.key`` already exists. A future
    version of sqlalchemy will instead rise a warning.

    .. versionadded:: 1.4.0


Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé