SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4 Last Updated: 08/14/07 11:13:06

module sqlalchemy.ansisql

Defines ANSI SQL operations.

Contains default implementations for the abstract objects in the sql module.

class ANSICompiler(Compiled,ClauseVisitor)

Default implementation of Compiled.

Compiles ClauseElements into ANSI-compliant SQL strings.

def __init__(self, dialect, statement, parameters=None, **kwargs)

Construct a new ANSICompiler object.

dialect
Dialect to be used
statement
ClauseElement to be compiled
parameters
optional dictionary indicating a set of bind parameters specified with this Compiled object. These parameters are the default key/value pairs when the Compiled is executed, and also may affect the actual compilation, as in the case of an INSERT where the actual columns inserted will correspond to the keys present in the parameters.
def after_compile(self)
def apply_function_parens(self, func)
def bindparam_string(self, name)
def compile(self)
def construct_params(self, params)

Return a sql.ClauseParameters object.

Combines the given bind parameter dictionary (string keys to object values) with the _BindParamClause objects stored within this Compiled object to produce a ClauseParameters structure, representing the bind arguments for a single statement execution, or one element of an executemany execution.

def default_from(self)

Called when a SELECT statement has no froms, and no FROM clause is to be appended.

Gives Oracle a chance to tack on a FROM DUAL to the string output.

def for_update_clause(self, select)
def get_select_precolumns(self, select)

Called when building a SELECT statement, position is just before column list.

def get_whereclause(self, obj)

given a FROM clause, return an additional WHERE condition that should be applied to a SELECT.

Currently used by Oracle to provide WHERE criterion for JOIN and OUTER JOIN constructs in non-ansi mode.

def is_subquery(self, select)
def label_select_column(self, select, column)

convert a column from a select's "columns" clause.

given a select() and a column element from its inner_columns collection, return a Label object if this column should be labeled in the columns clause. Otherwise, return None and the column will be used as-is.

The calling method will traverse the returned label to acquire its string representation.

def limit_clause(self, select)
def operator_string(self, operator)
def order_by_clause(self, select)
params = property()

Return the ClauseParameters corresponding to this compiled object. A shortcut for construct_params().

def process(self, obj, stack=None, **kwargs)
def uses_sequences_for_inserts(self)
def visit_alias(self, alias, asfrom=False, **kwargs)
def visit_binary(self, binary, **kwargs)
def visit_bindparam(self, bindparam, **kwargs)
def visit_calculatedclause(self, clause, **kwargs)
def visit_cast(self, cast, **kwargs)
def visit_clauselist(self, clauselist, **kwargs)
def visit_column(self, column, **kwargs)
def visit_compound_select(self, cs, asfrom=False, parens=True, **kwargs)
def visit_delete(self, delete_stmt)
def visit_fromclause(self, fromclause, **kwargs)
def visit_function(self, func, **kwargs)
def visit_grouping(self, grouping, **kwargs)
def visit_index(self, index, **kwargs)
def visit_insert(self, insert_stmt)
def visit_join(self, join, asfrom=False, **kwargs)
def visit_label(self, label)
def visit_null(self, null, **kwargs)
def visit_release_savepoint(self, savepoint_stmt)
def visit_rollback_to_savepoint(self, savepoint_stmt)
def visit_savepoint(self, savepoint_stmt)
def visit_select(self, select, asfrom=False, parens=True, **kwargs)
def visit_table(self, table, asfrom=False, **kwargs)
def visit_textclause(self, textclause, **kwargs)
def visit_typeclause(self, typeclause, **kwargs)
def visit_unary(self, unary, **kwargs)
def visit_update(self, update_stmt)
back to section top

class ANSIDefaultRunner(DefaultRunner)

back to section top

class ANSIDialect(DefaultDialect)

def __init__(self, cache_identifiers=True, **kwargs)

Construct a new ANSIDialect.

def compiler(self, statement, parameters, **kwargs)
def create_connect_args(self)
def preparer(self)

Return an IdentifierPreparer.

This object is used to format table and column names including proper quoting and case conventions.

def schemadropper(self, *args, **kwargs)
def schemagenerator(self, *args, **kwargs)
back to section top

class ANSIIdentifierPreparer(object)

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

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

Construct a new ANSIIdentifierPreparer 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, name=None)
def format_column(self, column, use_table=False, name=None, table_name=None)

Prepare a quoted column name.

def format_column_with_table(self, column, column_name=None, table_name=None)

Prepare a quoted column name with table name.

def format_constraint(self, constraint)
def format_index(self, index)
def format_label(self, label, name=None)
def format_savepoint(self, savepoint, name=None)
def format_sequence(self, sequence)
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_identifier(self, value)

Quote an identifier.

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

def should_quote(self, object)
def unformat_identifiers(self, identifiers)

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

back to section top

class ANSISchemaBase(SchemaIterator)

def find_alterables(self, tables)
back to section top

class ANSISchemaDropper(ANSISchemaBase)

def __init__(self, dialect, connection, checkfirst=False, tables=None, **kwargs)

Construct a new ANSISchemaDropper.

def drop_foreignkey(self, constraint)
def visit_index(self, index)
def visit_metadata(self, metadata)
def visit_table(self, table)
back to section top

class ANSISchemaGenerator(ANSISchemaBase)

def __init__(self, dialect, connection, checkfirst=False, tables=None, **kwargs)

Construct a new ANSISchemaGenerator.

def add_foreignkey(self, constraint)
def define_foreign_key(self, constraint)
def get_column_default_string(self, column)
def get_column_specification(self, column, first_pk=False)
def post_create_table(self, table)
def visit_check_constraint(self, constraint)
def visit_column(self, column)
def visit_column_check_constraint(self, constraint)
def visit_foreign_key_constraint(self, constraint)
def visit_index(self, index)
def visit_metadata(self, metadata)
def visit_primary_key_constraint(self, constraint)
def visit_table(self, table)
def visit_unique_constraint(self, constraint)
back to section top
Up: API Documentation | Previous: module sqlalchemy.engine.threadlocal | Next: module sqlalchemy.interfaces