# sql/expression.py # Copyright (C) 2005-2013 the SQLAlchemy authors and contributors # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Defines the public namespace for SQL expression constructs. Prior to version 0.9, this module contained all of "elements", "dml", "default_comparator" and "selectable". The module was broken up and most "factory" functions were moved to be grouped with their associated class. """ __all__ = [ 'Alias', 'ClauseElement', 'ColumnCollection', 'ColumnElement', 'CompoundSelect', 'Delete', 'FromClause', 'Insert', 'Join', 'Select', 'Selectable', 'TableClause', 'Update', 'alias', 'and_', 'asc', 'between', 'bindparam', 'case', 'cast', 'column', 'delete', 'desc', 'distinct', 'except_', 'except_all', 'exists', 'extract', 'func', 'modifier', 'collate', 'insert', 'intersect', 'intersect_all', 'join', 'label', 'literal', 'literal_column', 'not_', 'null', 'nullsfirst', 'nullslast', 'or_', 'outparam', 'outerjoin', 'over', 'select', 'subquery', 'table', 'text', 'tuple_', 'type_coerce', 'union', 'union_all', 'update'] from .visitors import Visitable from .functions import func, modifier, FunctionElement from ..util.langhelpers import public_factory from .elements import ClauseElement, ColumnElement,\ BindParameter, UnaryExpression, BooleanClauseList, \ Label, Cast, Case, ColumnClause, TextClause, Over, Null, \ True_, False_, BinaryExpression, Tuple, TypeClause, Extract, \ Grouping, and_, or_, not_, \ collate, literal_column, between,\ literal, outparam, type_coerce, ClauseList from .base import ColumnCollection, Generative, Executable, \ PARSE_AUTOCOMMIT from .selectable import Alias, Join, Select, Selectable, TableClause, \ CompoundSelect, FromClause, FromGrouping, SelectBase, \ alias, \ subquery, HasPrefixes, Exists, ScalarSelect from .dml import Insert, Update, Delete # factory functions - these pull class-bound constructors and classmethods # from SQL elements and selectables into public functions. This allows # the functions to be available in the sqlalchemy.sql.* namespace and # to be auto-cross-documenting from the function to the class itself. bindparam = public_factory(BindParameter) select = public_factory(Select) text = public_factory(TextClause) table = public_factory(TableClause) column = public_factory(ColumnClause) over = public_factory(Over) label = public_factory(Label) case = public_factory(Case) cast = public_factory(Cast) extract = public_factory(Extract) tuple_ = public_factory(Tuple) except_ = public_factory(CompoundSelect._create_except) except_all = public_factory(CompoundSelect._create_except_all) intersect = public_factory(CompoundSelect._create_intersect) intersect_all = public_factory(CompoundSelect._create_intersect_all) union = public_factory(CompoundSelect._create_union) union_all = public_factory(CompoundSelect._create_union_all) exists = public_factory(Exists) nullsfirst = public_factory(UnaryExpression._create_nullsfirst) nullslast = public_factory(UnaryExpression._create_nullslast) asc = public_factory(UnaryExpression._create_asc) desc = public_factory(UnaryExpression._create_desc) distinct = public_factory(UnaryExpression._create_distinct) true = public_factory(True_) false = public_factory(False_) null = public_factory(Null) join = public_factory(Join._create_join) outerjoin = public_factory(Join._create_outerjoin) insert = public_factory(Insert) update = public_factory(Update) delete = public_factory(Delete) # internal functions still being called from tests and the ORM, # these might be better off in some other namespace from .base import _from_objects from .elements import _literal_as_text, _clause_element_as_expr,\ _is_column, _labeled, _only_column_elements, _string_or_unprintable, \ _truncated_label, _clone, _cloned_difference, _cloned_intersection,\ _column_as_key, _literal_as_binds, _select_iterables, \ _corresponding_column_or_error from .selectable import _interpret_as_from # old names for compatibility _Executable = Executable _BindParamClause = BindParameter _Label = Label _SelectBase = SelectBase _BinaryExpression = BinaryExpression _Cast = Cast _Null = Null _False = False_ _True = True_ _TextClause = TextClause _UnaryExpression = UnaryExpression _Case = Case _Tuple = Tuple _Over = Over _Generative = Generative _TypeClause = TypeClause _Extract = Extract _Exists = Exists _Grouping = Grouping _FromGrouping = FromGrouping _ScalarSelect = ScalarSelect