SQLAlchemy 0.4 Documentation
module sqlalchemy.sql.compiler
Base SQL and DDL compiler implementations.
Provides the DefaultCompiler class, which is responsible for generating all SQL query strings, as well as SchemaGenerator and SchemaDropper which issue CREATE and DROP DDL for tables, sequences, and indexes.
The elements in this module are used by public-facing constructs like ClauseElement and Engine. While dialect authors will want to be familiar with this module for the purpose of creating database-specific compilers and schema generators, the module is otherwise internal to SQLAlchemy.
class DefaultCompiler(Compiled)
Default implementation of Compiled.
Compiles ClauseElements into SQL strings. Uses a similar visit paradigm as visitors.ClauseVisitor but implements its own traversal.
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.
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.
Called when building a SELECT statement, position is just before column list.
class IdentifierPreparer(object)
Handle quoting and case-folding of identifiers based on options.
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.
Prepare a quoted column name.
deprecated. use preparer.quote(col, column.name) or combine with format_table()
Quote an identifier.
Subclasses should override this to provide database-dependent quoting behavior.
Unpack 'schema.table.column'-like strings into components.
class SchemaDropper(DDLBase)
Construct a new SchemaDropper.
class SchemaGenerator(DDLBase)
Construct a new SchemaGenerator.
