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 ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Module « sqlalchemy »

Classe « Uuid »

Informations générales

Héritage

builtins.object
    Generic
builtins.object
    Visitable
        TypeEngine
builtins.object
    TypeEngineMixin
        Emulated
            Uuid

Définition

class Uuid(Emulated, TypeEngine):

help(Uuid)

Represent a database agnostic UUID datatype.

For backends that have no "native" UUID datatype, the value will
make use of ``CHAR(32)`` and store the UUID as a 32-character alphanumeric
hex string.

For backends which are known to support ``UUID`` directly or a similar
uuid-storing datatype such as SQL Server's ``UNIQUEIDENTIFIER``, a
"native" mode enabled by default allows these types will be used on those
backends.

In its default mode of use, the :class:`_sqltypes.Uuid` datatype expects
**Python uuid objects**, from the Python
`uuid <https://docs.python.org/3/library/uuid.html>`_
module::

    import uuid

    from sqlalchemy import Uuid
    from sqlalchemy import Table, Column, MetaData, String


    metadata_obj = MetaData()

    t = Table(
        "t",
        metadata_obj,
        Column("uuid_data", Uuid, primary_key=True),
        Column("other_data", String),
    )

    with engine.begin() as conn:
        conn.execute(
            t.insert(), {"uuid_data": uuid.uuid4(), "other_data": "some data"}
        )

To have the :class:`_sqltypes.Uuid` datatype work with string-based
Uuids (e.g. 32 character hexadecimal strings), pass the
:paramref:`_sqltypes.Uuid.as_uuid` parameter with the value ``False``.

.. versionadded:: 2.0

.. seealso::

    :class:`_sqltypes.UUID` - represents exactly the ``UUID`` datatype
    without any backend-agnostic behaviors.

Constructeur(s)

Signature du constructeur Description
__init__(self, as_uuid: 'bool' = True, native_uuid: 'bool' = True) Construct a :class:`_sqltypes.Uuid` type. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
collationNone
hashableTrue
render_bind_castFalse
render_literal_castFalse
should_evaluate_noneFalse
sort_key_functionNone

Liste des propriétés

Nom de la propriétéDescription
native
python_type

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
bind_processor(self, dialect)
coerce_compared_value(self, op, value) See :meth:`.TypeEngine.coerce_compared_value` for a description. [extrait de coerce_compared_value.__doc__]
literal_processor(self, dialect)
result_processor(self, dialect, coltype)

Méthodes héritées de la classe TypeEngine

__repr__, __str__, __subclasshook__, adapt, as_generic, bind_expression, column_expression, Comparator, comparator_factory, compare_values, compile, copy, copy_value, dialect_impl, evaluates_none, get_dbapi_type, with_variant

Méthodes héritées de la classe Generic

__class_getitem__, __init_subclass__

Méthodes héritées de la classe Visitable

__class_getitem__, __init_subclass__

Méthodes héritées de la classe Emulated

adapt_to_emulated

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__

Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé