class documentation

Handle quoting and case-folding of identifiers based on options.

Method __init__ Construct a new ``IdentifierPreparer`` object.
Method format_alias Undocumented
Method format_collation Undocumented
Method format_column Prepare a quoted column name.
Method format_constraint Undocumented
Method format_index Undocumented
Method format_label Undocumented
Method format_label_name Prepare a quoted column name.
Method format_savepoint Undocumented
Method format_schema Prepare a quoted schema name.
Method format_sequence Undocumented
Method format_table Prepare a quoted table and schema name.
Method format_table_seq Format table name and schema as a tuple.
Method quote Conditionally quote an identifier.
Method quote_identifier Quote an identifier.
Method quote_schema Conditionally quote a schema name.
Method truncate_and_render_constraint_name Undocumented
Method truncate_and_render_index_name Undocumented
Method unformat_identifiers Unpack 'schema.table.column'-like strings into components.
Method validate_sql_phrase keyword sequence filter.
Class Variable schema_for_object Return the .schema attribute for an object.
Instance Variable dialect Undocumented
Instance Variable escape_quote Undocumented
Instance Variable escape_to_quote Undocumented
Instance Variable final_quote Undocumented
Instance Variable initial_quote Undocumented
Instance Variable omit_schema Undocumented
Instance Variable quote_case_sensitive_collations Undocumented
Method _escape_identifier Escape an identifier.
Method _render_schema_translates Undocumented
Method _requires_quotes Return True if the given identifier requires quoting.
Method _requires_quotes_illegal_chars Return True if the given identifier requires quoting, but not taking case convention into account.
Method _truncate_and_render_maxlen_name Undocumented
Method _unescape_identifier Canonicalize an escaped identifier.
Method _with_schema_translate Undocumented
Instance Variable _double_percents Undocumented
Instance Variable _strings Undocumented
Property _r_identifiers Undocumented
def __init__(self, dialect, initial_quote='"', final_quote=None, escape_quote='"', quote_case_sensitive_collations=True, omit_schema=False): (source)

Construct a new ``IdentifierPreparer`` object. initial_quote Character that begins a delimited identifier. final_quote Character that ends a delimited identifier. Defaults to `initial_quote`. omit_schema Prevent prepending schema name. Useful for databases that do not support schemae.

def format_alias(self, alias: Optional[AliasedReturnsRows], name: Optional[str] = None) -> str: (source)

Undocumented

def format_collation(self, collation_name): (source)

Undocumented

def format_column(self, column, use_table=False, name=None, table_name=None, use_schema=False, anon_map=None): (source)

Prepare a quoted column name.

@util.preload_module('sqlalchemy.sql.naming')
def format_constraint(self, constraint, _alembic_quote=True): (source)

Undocumented

def format_index(self, index): (source)

Undocumented

def format_label(self, label: Label[Any], name: Optional[str] = None) -> str: (source)

Undocumented

def format_label_name(self, name, anon_map=None): (source)

Prepare a quoted column name.

def format_savepoint(self, savepoint, name=None): (source)
def format_schema(self, name): (source)

Prepare a quoted schema name.

def format_sequence(self, sequence, use_schema=True): (source)

Undocumented

def format_table(self, table, use_schema=True, name=None): (source)

Prepare a quoted table and schema name.

def format_table_seq(self, table, use_schema=True): (source)

Format table name and schema as a tuple.

def quote(self, ident: str, force: Any = None) -> str: (source)

Conditionally quote an identifier. The identifier is quoted if it is a reserved word, contains quote-necessary characters, or is an instance of :class:`.quoted_name` which includes ``quote`` set to ``True``. Subclasses can override this to provide database-dependent quoting behavior for identifier names. :param ident: string identifier :param force: unused .. deprecated:: 0.9 The :paramref:`.IdentifierPreparer.quote.force` parameter is deprecated and will be removed in a future release. This flag has no effect on the behavior of the :meth:`.IdentifierPreparer.quote` method; please refer to :class:`.quoted_name`.

def quote_identifier(self, value: str) -> str: (source)

Quote an identifier. Subclasses should override this to provide database-dependent quoting behavior.

def quote_schema(self, schema: str, force: Any = None) -> str: (source)

Conditionally quote a schema name. The name is quoted if it is a reserved word, contains quote-necessary characters, or is an instance of :class:`.quoted_name` which includes ``quote`` set to ``True``. Subclasses can override this to provide database-dependent quoting behavior for schema names. :param schema: string schema name :param force: unused .. deprecated:: 0.9 The :paramref:`.IdentifierPreparer.quote_schema.force` parameter is deprecated and will be removed in a future release. This flag has no effect on the behavior of the :meth:`.IdentifierPreparer.quote` method; please refer to :class:`.quoted_name`.

def truncate_and_render_constraint_name(self, name, _alembic_quote=True): (source)

Undocumented

def truncate_and_render_index_name(self, name, _alembic_quote=True): (source)

Undocumented

def unformat_identifiers(self, identifiers): (source)

Unpack 'schema.table.column'-like strings into components.

def validate_sql_phrase(self, element, reg): (source)

keyword sequence filter. a filter for elements that are intended to represent keyword sequences, such as "INITIALLY", "INITIALLY DEFERRED", etc. no special characters should be present. .. versionadded:: 1.3

Return the .schema attribute for an object. For the default IdentifierPreparer, the schema for an object is always the value of the ".schema" attribute. if the preparer is replaced with one that has a non-empty schema_translate_map, the value of the ".schema" attribute is rendered a symbol that will be converted to a real schema name from the mapping post-compile.

Undocumented

escape_quote = (source)

Undocumented

escape_to_quote = (source)

Undocumented

final_quote = (source)

Undocumented

initial_quote = (source)

Undocumented

omit_schema = (source)

Undocumented

quote_case_sensitive_collations = (source)

Undocumented

def _escape_identifier(self, value: str) -> str: (source)

Escape an identifier. Subclasses should override this to provide database-dependent escaping behavior.

def _render_schema_translates(self, statement, schema_translate_map): (source)

Undocumented

def _requires_quotes(self, value: str) -> bool: (source)

Return True if the given identifier requires quoting.

def _requires_quotes_illegal_chars(self, value): (source)

Return True if the given identifier requires quoting, but not taking case convention into account.

def _truncate_and_render_maxlen_name(self, name, max_, _alembic_quote): (source)

Undocumented

def _unescape_identifier(self, value: str) -> str: (source)

Canonicalize an escaped identifier. Subclasses should override this to provide database-dependent unescaping behavior that reverses _escape_identifier.

def _with_schema_translate(self, schema_translate_map): (source)

Undocumented

_strings: dict = (source)

Undocumented

@util.memoized_property
_r_identifiers = (source)

Undocumented