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 ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « sqlalchemy »

Classe « Numeric »

Informations générales

Héritage

builtins.object
    Generic
builtins.object
    Visitable
        TypeEngine
builtins.object
    TypeEngineMixin
        HasExpressionLookup
            Numeric

Définition

class Numeric(HasExpressionLookup, TypeEngine):

help(Numeric)

Base for non-integer numeric types, such as
``NUMERIC``, ``FLOAT``, ``DECIMAL``, and other variants.

The :class:`.Numeric` datatype when used directly will render DDL
corresponding to precision numerics if available, such as
``NUMERIC(precision, scale)``.  The :class:`.Float` subclass will
attempt to render a floating-point datatype such as ``FLOAT(precision)``.

:class:`.Numeric` returns Python ``decimal.Decimal`` objects by default,
based on the default value of ``True`` for the
:paramref:`.Numeric.asdecimal` parameter.  If this parameter is set to
False, returned values are coerced to Python ``float`` objects.

The :class:`.Float` subtype, being more specific to floating point,
defaults the :paramref:`.Float.asdecimal` flag to False so that the
default Python datatype is ``float``.

.. note::

    When using a :class:`.Numeric` datatype against a database type that
    returns Python floating point values to the driver, the accuracy of the
    decimal conversion indicated by :paramref:`.Numeric.asdecimal` may be
    limited.   The behavior of specific numeric/floating point datatypes
    is a product of the SQL datatype in use, the Python :term:`DBAPI`
    in use, as well as strategies that may be present within
    the SQLAlchemy dialect in use.   Users requiring specific precision/
    scale are encouraged to experiment with the available datatypes
    in order to determine the best results.

Constructeur(s)

Signature du constructeur Description
__init__(self, precision: 'Optional[int]' = None, scale: 'Optional[int]' = None, decimal_return_scale: 'Optional[int]' = None, asdecimal: 'bool' = True)

Liste des attributs statiques

Nom de l'attribut Valeur
hashableTrue
render_bind_castFalse
render_literal_castFalse
should_evaluate_noneFalse
sort_key_functionNone

Liste des propriétés

Nom de la propriétéDescription
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)
get_dbapi_type(self, dbapi)
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, coerce_compared_value, column_expression, Comparator, comparator_factory, compare_values, compile, copy, copy_value, dialect_impl, evaluates_none, 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 object

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

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé