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 ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Classe « NUMERIC »

Constructeur sqlalchemy.NUMERIC.__init__

Signature de la constructeur __init__

def __init__(self, precision: 'Optional[int]' = None, scale: 'Optional[int]' = None, decimal_return_scale: 'Optional[int]' = None, asdecimal: 'bool' = True) 

Description

help(NUMERIC.__init__)

Construct a Numeric.

:param precision: the numeric precision for use in DDL ``CREATE
  TABLE``.

:param scale: the numeric scale for use in DDL ``CREATE TABLE``.

:param asdecimal: default True.  Return whether or not
  values should be sent as Python Decimal objects, or
  as floats.   Different DBAPIs send one or the other based on
  datatypes - the Numeric type will ensure that return values
  are one or the other across DBAPIs consistently.

:param decimal_return_scale: Default scale to use when converting
 from floats to Python decimals.  Floating point values will typically
 be much longer due to decimal inaccuracy, and most floating point
 database types don't have a notion of "scale", so by default the
 float type looks for the first ten decimal places when converting.
 Specifying this value will override that length.  Types which
 do include an explicit ".scale" value, such as the base
 :class:`.Numeric` as well as the MySQL float types, will use the
 value of ".scale" as the default for decimal_return_scale, if not
 otherwise specified.

When using the ``Numeric`` type, care should be taken to ensure
that the asdecimal setting is appropriate for the DBAPI in use -
when Numeric applies a conversion from Decimal->float or float->
Decimal, this conversion incurs an additional performance overhead
for all result columns received.

DBAPIs that return Decimal natively (e.g. psycopg2) will have
better accuracy and higher performance with a setting of ``True``,
as the native translation to Decimal reduces the amount of floating-
point issues at play, and the Numeric type itself doesn't need
to apply any further conversions.  However, another DBAPI which
returns floats natively *will* incur an additional conversion
overhead, and is still subject to floating point data loss - in
which case ``asdecimal=False`` will at least remove the extra
conversion overhead.



Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé