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 « quoted_name »

Informations générales

Héritage

builtins.object
    builtins.str
builtins.object
    MemoizedSlots
        quoted_name

Définition

class quoted_name(MemoizedSlots, builtins.str):

help(quoted_name)

Represent a SQL identifier combined with quoting preferences.

:class:`.quoted_name` is a Python unicode/str subclass which
represents a particular identifier name along with a
``quote`` flag.  This ``quote`` flag, when set to
``True`` or ``False``, overrides automatic quoting behavior
for this identifier in order to either unconditionally quote
or to not quote the name.  If left at its default of ``None``,
quoting behavior is applied to the identifier on a per-backend basis
based on an examination of the token itself.

A :class:`.quoted_name` object with ``quote=True`` is also
prevented from being modified in the case of a so-called
"name normalize" option.  Certain database backends, such as
Oracle Database, Firebird, and DB2 "normalize" case-insensitive names
as uppercase.  The SQLAlchemy dialects for these backends
convert from SQLAlchemy's lower-case-means-insensitive convention
to the upper-case-means-insensitive conventions of those backends.
The ``quote=True`` flag here will prevent this conversion from occurring
to support an identifier that's quoted as all lower case against
such a backend.

The :class:`.quoted_name` object is normally created automatically
when specifying the name for key schema constructs such as
:class:`_schema.Table`, :class:`_schema.Column`, and others.
The class can also be
passed explicitly as the name to any function that receives a name which
can be quoted.  Such as to use the :meth:`_engine.Engine.has_table`
method with
an unconditionally quoted name::

    from sqlalchemy import create_engine
    from sqlalchemy import inspect
    from sqlalchemy.sql import quoted_name

    engine = create_engine("oracle+oracledb://some_dsn")
    print(inspect(engine).has_table(quoted_name("some_table", True)))

The above logic will run the "has table" logic against the Oracle Database
backend, passing the name exactly as ``"some_table"`` without converting to
upper case.

.. versionchanged:: 1.2 The :class:`.quoted_name` construct is now
   importable from ``sqlalchemy.sql``, in addition to the previous
   location of ``sqlalchemy.sql.elements``.

Constructeur(s)

Signature du constructeur Description
__new__(cls, value: 'str', quote: 'Optional[bool]') -> 'quoted_name'
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
lower<member 'lower' of 'quoted_name' objects>
quote<member 'quote' of 'quoted_name' objects>
upper<member 'upper' of 'quoted_name' objects>

Liste des opérateurs

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

__add__, __contains__, __eq__, __ge__, __getitem__, __gt__, __le__, __lt__, __mod__, __mul__, __ne__, __rmod__, __rmul__

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
__reduce__(self)
construct(value: 'Optional[str]', quote: 'Optional[bool]') -> 'Optional[quoted_name]'

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

__format__, __getnewargs__, __hash__, __init_subclass__, __iter__, __len__, __repr__, __sizeof__, __str__, __subclasshook__, capitalize, casefold, center, count, encode, endswith, expandtabs, find, format, format_map, index, isalnum, isalpha, isascii, isdecimal, isdigit, isidentifier, islower, isnumeric, isprintable, isspace, istitle, isupper, join, ljust, lower, lstrip, maketrans, partition, removeprefix, removesuffix, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill

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

__getattr__, __init_subclass__, __subclasshook__

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

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__

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