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 fondamentaux
Voir le programme détaillé
Module « sqlalchemy »

Classe « Unicode »

Informations générales

Héritage

builtins.object
    Generic
builtins.object
    Visitable
        TypeEngine
builtins.object
    TypeEngineMixin
        Concatenable
            String
                Unicode

Définition

class Unicode(String):

help(Unicode)

A variable length Unicode string type.

The :class:`.Unicode` type is a :class:`.String` subclass that assumes
input and output strings that may contain non-ASCII characters, and for
some backends implies an underlying column type that is explicitly
supporting of non-ASCII data, such as ``NVARCHAR`` on Oracle Database and
SQL Server.  This will impact the output of ``CREATE TABLE`` statements and
``CAST`` functions at the dialect level.

The character encoding used by the :class:`.Unicode` type that is used to
transmit and receive data to the database is usually determined by the
DBAPI itself. All modern DBAPIs accommodate non-ASCII strings but may have
different methods of managing database encodings; if necessary, this
encoding should be configured as detailed in the notes for the target DBAPI
in the :ref:`dialect_toplevel` section.

In modern SQLAlchemy, use of the :class:`.Unicode` datatype does not
imply any encoding/decoding behavior within SQLAlchemy itself.  In Python
3, all string objects are inherently Unicode capable, and SQLAlchemy
does not produce bytestring objects nor does it accommodate a DBAPI that
does not return Python Unicode objects in result sets for string values.

.. warning:: Some database backends, particularly SQL Server with pyodbc,
   are known to have undesirable behaviors regarding data that is noted
   as being of ``NVARCHAR`` type as opposed to ``VARCHAR``, including
   datatype mismatch errors and non-use of indexes.  See the section
   on :meth:`.DialectEvents.do_setinputsizes` for background on working
   around unicode character issues for backends like SQL Server with
   pyodbc as well as cx_Oracle.

.. seealso::

    :class:`.UnicodeText` - unlengthed textual counterpart
    to :class:`.Unicode`.

    :meth:`.DialectEvents.do_setinputsizes`

Constructeur(s)

Signature du constructeur Description
__init__(self, length: 'Optional[int]' = None, collation: 'Optional[str]' = None)

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

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

__subclasshook__, bind_processor, get_dbapi_type, literal_processor, result_processor

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

__repr__, __str__, 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 ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé