class documentation

class quoted_name(util.MemoizedSlots, util.text_type):

Known subclasses: sqlalchemy.sql.elements._truncated_label

View In Hierarchy

Represent a SQL identifier combined with quoting preferences.

.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 .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, 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 .quoted_name object is normally created automatically when specifying the name for key schema constructs such as _schema.Table, _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 _engine.Engine.has_table method with an unconditionally quoted name:

from sqlalchemy import create_engine
from sqlalchemy.sql import quoted_name

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

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

New in version 0.9.0.
Changed in version 1.2: The .quoted_name construct is now importable from sqlalchemy.sql, in addition to the previous location of sqlalchemy.sql.elements.
Instance Variable quote Undocumented
Method __new__ Undocumented
Method __reduce__ Undocumented
Method __repr__ Undocumented
Method ​_memoized​_method​_lower Undocumented
Method ​_memoized​_method​_upper Undocumented
Class Variable __slots__ Undocumented

Inherited from MemoizedSlots:

Method __getattr__ Undocumented
Method ​_fallback​_getattr Undocumented
quote =

Undocumented

def __new__(cls, value, quote):

Undocumented

def __reduce__(self):

Undocumented

def __repr__(self):

Undocumented

def _memoized_method_lower(self):

Undocumented

def _memoized_method_upper(self):

Undocumented

__slots__: tuple[str, ...] =