class documentation

base class for SQL elements that can be compiled to produce a SQL string. .. versionadded:: 2.0

Method __str__ Undocumented
Method compile Compile this SQL expression.
Class Variable __slots__ Undocumented
Class Variable __visit_name__ Undocumented
Class Variable stringify_dialect Undocumented
Class Variable supports_execution Undocumented
Method _compiler Return a compiler appropriate for this ClauseElement, given a Dialect.

Inherited from Visitable:

Method __class_getitem__ Undocumented
Method __init_subclass__ Undocumented
Class Method _generate_compiler_dispatch Undocumented
Method _compiler_dispatch Undocumented
Class Variable _original_compiler_dispatch Undocumented
@util.preload_module('sqlalchemy.engine.default')
@util.preload_module('sqlalchemy.engine.url')
def compile(self, bind: Optional[Union[Engine, Connection]] = None, dialect: Optional[Dialect] = None, **kw: Any) -> Compiled: (source)

Compile this SQL expression. The return value is a :class:`~.Compiled` object. Calling ``str()`` or ``unicode()`` on the returned value will yield a string representation of the result. The :class:`~.Compiled` object also can return a dictionary of bind parameter names and values using the ``params`` accessor. :param bind: An :class:`.Connection` or :class:`.Engine` which can provide a :class:`.Dialect` in order to generate a :class:`.Compiled` object. If the ``bind`` and ``dialect`` parameters are both omitted, a default SQL compiler is used. :param column_keys: Used for INSERT and UPDATE statements, a list of column names which should be present in the VALUES clause of the compiled statement. If ``None``, all columns from the target table object are rendered. :param dialect: A :class:`.Dialect` instance which can generate a :class:`.Compiled` object. This argument takes precedence over the ``bind`` argument. :param compile_kwargs: optional dictionary of additional parameters that will be passed through to the compiler within all "visit" methods. This allows any custom flag to be passed through to a custom compilation construct, for example. It is also used for the case of passing the ``literal_binds`` flag through:: from sqlalchemy.sql import table, column, select t = table('t', column('x')) s = select(t).where(t.c.x == 5) print(s.compile(compile_kwargs={"literal_binds": True})) .. versionadded:: 0.9.0 .. seealso:: :ref:`faq_sql_expression_string`

supports_execution: bool = (source)

Undocumented

def _compiler(self, dialect: Dialect, **kw: Any) -> Compiled: (source)

Return a compiler appropriate for this ClauseElement, given a Dialect.