SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4beta6 Last Updated: 09/26/07 20:38:24

module sqlalchemy.sql.compiler

SQL expression compilation routines and DDL implementations.

class DDLBase(SchemaIterator)

def find_alterables(self, tables)
back to section top

class DefaultCompiler(Compiled,ClauseVisitor)

Default implementation of Compiled.

Compiles ClauseElements into SQL strings.

def __init__(self, dialect, statement, column_keys=None, inline=False, **kwargs)

Construct a new DefaultCompiler object.

dialect
Dialect to be used
statement
ClauseElement to be compiled
column_keys
a list of column names to be compiled into an INSERT or UPDATE statement.
def after_compile(self)
def apply_function_parens(self, func)
def bindparam_string(self, name)
def compile(self)
def construct_params(self, params=None)

Return a sql.util.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 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_sequence(self, seq)
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 IdentifierPreparer(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 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, 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, use_schema=True)
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 SchemaDropper(DDLBase)

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

Construct a new SchemaDropper.

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 SchemaGenerator(DDLBase)

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

Construct a new SchemaGenerator.

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