class documentation

class IdentifierPreparer(object):

Known subclasses: sqlalchemy.databases.firebird.FBIdentifierPreparer, sqlalchemy.databases.mssql.MSIdentifierPreparer, sqlalchemy.databases.mysql.MySQLIdentifierPreparer, sqlalchemy.databases.oracle.OracleIdentifierPreparer, sqlalchemy.databases.postgresql.PGIdentifierPreparer, sqlalchemy.databases.sqlite.SQLiteIdentifierPreparer, sqlalchemy.databases.sybase.SybaseIdentifierPreparer

View In Hierarchy

Handle quoting and case-folding of identifiers based on options.
Method __init__ Construct a new IdentifierPreparer object.
Method format​_column Prepare a quoted column name.
Method format​_label​_name Prepare a quoted column name.
Method format​_schema Prepare a quoted schema name.
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 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.
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
Method format​_alias Undocumented
Method format​_collation Undocumented
Method format​_constraint Undocumented
Method format​_index Undocumented
Method format​_label Undocumented
Method format​_savepoint Undocumented
Method format​_sequence Undocumented
Method truncate​_and​_render​_constraint​_name Undocumented
Method truncate​_and​_render​_index​_name Undocumented
Instance Variable ​_double​_percents Undocumented
Instance Variable ​_strings Undocumented
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
Property ​_r​_identifiers Undocumented
def __init__(self, dialect, initial_quote='"', final_quote=None, escape_quote='"', quote_case_sensitive_collations=True, omit_schema=False):

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_column(self, column, use_table=False, name=None, table_name=None, use_schema=False, anon_map=None):
Prepare a quoted column name.
def format_label_name(self, name, anon_map=None):
Prepare a quoted column name.
def format_schema(self, name):
Prepare a quoted schema name.
def format_table(self, table, use_schema=True, name=None):
Prepare a quoted table and schema name.
def format_table_seq(self, table, use_schema=True):
Format table name and schema as a tuple.
def quote(self, ident, force=None):

Conditionally quote an identifier.

The identifier is quoted if it is a reserved word, contains quote-necessary characters, or is an instance of .quoted_name which includes quote set to True.

Subclasses can override this to provide database-dependent quoting behavior for identifier names.

Parameters
identstring identifier
force

unused

Deprecated since version 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 .IdentifierPreparer.quote method; please refer to .quoted_name.
def quote_identifier(self, value):

Quote an identifier.

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

def quote_schema(self, schema, force=None):

Conditionally quote a schema name.

The name is quoted if it is a reserved word, contains quote-necessary characters, or is an instance of .quoted_name which includes quote set to True.

Subclasses can override this to provide database-dependent quoting behavior for schema names.

Parameters
schemastring schema name
force

unused

Deprecated since version 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 .IdentifierPreparer.quote method; please refer to .quoted_name.
def unformat_identifiers(self, identifiers):
Unpack 'schema.table.column'-like strings into components.
def validate_sql_phrase(self, element, reg):

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.

New in version 1.3.
schema_for_object =

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.

def _escape_identifier(self, value):
def _render_schema_translates(self, statement, schema_translate_map):

Undocumented

def _requires_quotes(self, value):
Return True if the given identifier requires quoting.
def _requires_quotes_illegal_chars(self, value):
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):

Undocumented

def _unescape_identifier(self, value):

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):

Undocumented

def format_alias(self, alias, name=None):

Undocumented

def format_collation(self, collation_name):

Undocumented

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

Undocumented

def format_index(self, index):

Undocumented

def format_label(self, label, name=None):

Undocumented

def format_savepoint(self, savepoint, name=None):
def format_sequence(self, sequence, use_schema=True):

Undocumented

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

Undocumented

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

Undocumented

_strings: dict =

Undocumented

dialect =

Undocumented

escape_quote =

Undocumented

escape_to_quote =

Undocumented

final_quote =

Undocumented

initial_quote =

Undocumented

omit_schema =

Undocumented

quote_case_sensitive_collations =

Undocumented

@util.memoized_property
_r_identifiers =

Undocumented