sqlalchemy :: sql :: compiler :: IdentifierPreparer :: Class IdentifierPreparer
[hide private]
[frames] | no frames]

Class IdentifierPreparer


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

Instance Methods [hide private]
 
__init__(self, dialect, initial_quote='"', final_quote=None, escape_quote='"', omit_schema=False)
Construct a new ``IdentifierPreparer`` object.
 
_escape_identifier(self, value)
Escape an identifier.
 
_r_identifiers(...)
 
_requires_quotes(self, value)
Return True if the given identifier requires quoting.
 
_unescape_identifier(self, value)
Canonicalize an escaped identifier.
 
format_alias(self, alias, name=None)
 
format_column(self, column, use_table=False, name=None, table_name=None)
Prepare a quoted column name.
 
format_constraint(self, constraint)
 
format_label(self, label, name=None)
 
format_savepoint(self, savepoint, name=None)
 
format_schema(self, name, quote=None)
Prepare a quoted schema name.
 
format_sequence(self, sequence, use_schema=True)
 
format_table(self, table, use_schema=True, name=None)
Prepare a quoted table and schema name.
 
format_table_seq(self, table, use_schema=True)
Format table name and schema as a tuple.
 
quote(self, ident, force=None)
Conditionally quote an identifier.
 
quote_identifier(self, value)
Quote an identifier.
 
quote_schema(self, schema, force=None)
Conditionally quote a schema.
 
unformat_identifiers(self, identifiers)
Unpack 'schema.table.column'-like strings into components.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  illegal_initial_characters = set(['$', '0', '1', '2', '3', '4'...
  legal_characters = re.compile(r'(?i)^[A-Z0-9_\$]+$')
  reserved_words = set(['all', 'analyse', 'analyze', 'and', 'any...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dialect, initial_quote='"', final_quote=None, escape_quote='"', omit_schema=False)
(Constructor)

 
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.

Overrides: object.__init__

_escape_identifier(self, value)

 

Escape an identifier.

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

_unescape_identifier(self, value)

 

Canonicalize an escaped identifier.

Subclasses should override this to provide database-dependent unescaping behavior that reverses _escape_identifier.

quote(self, ident, force=None)

 

Conditionally quote an identifier.

the 'force' flag should be considered deprecated.

quote_identifier(self, value)

 

Quote an identifier.

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

quote_schema(self, schema, force=None)

 

Conditionally quote a schema.

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

the 'force' flag should be considered deprecated.


Class Variable Details [hide private]

illegal_initial_characters

Value:
set(['$', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])

reserved_words

Value:
set(['all',
     'analyse',
     'analyze',
     'and',
     'any',
     'array',
     'as',
     'asc',
...