flask_sqlalchemy :: BaseQuery :: Class BaseQuery
[hide private]
[frames] | no frames]

Class BaseQuery


The default query object used for models, and exposed as :attr:`~SQLAlchemy.Query`. This can be subclassed and replaced for individual models by setting the :attr:`~Model.query_class` attribute. This is a subclass of a standard SQLAlchemy :class:`~sqlalchemy.orm.query.Query` class and has all the methods of a standard query as well.

Instance Methods [hide private]
 
first_or_404(self)
Like :meth:`first` but aborts with 404 if not found instead of returning `None`.
 
get_or_404(self, ident)
Like :meth:`get` but aborts with 404 if not found instead of returning `None`.
 
paginate(self, page, per_page=20, error_out=True)
Returns `per_page` items from page `page`.

Inherited from sqlalchemy.orm.query.Query: __clause_element__, __getitem__, __init__, __iter__, __str__, add_column, add_columns, add_entity, all, as_scalar, autoflush, correlate, count, cte, delete, dispatch, distinct, enable_assertions, enable_eagerloads, except_, except_all, execution_options, exists, filter, filter_by, first, from_self, from_statement, get, group_by, having, instances, intersect, intersect_all, join, label, limit, merge_result, offset, one, one_or_none, options, order_by, outerjoin, params, populate_existing, prefix_with, reset_joinpoint, scalar, select_entity_from, select_from, slice, subquery, suffix_with, union, union_all, update, value, values, with_entities, with_for_update, with_hint, with_labels, with_lockmode, with_parent, with_polymorphic, with_session, with_statement_hint, with_transformation, yield_per

Inherited from sqlalchemy.orm.query.Query (private): _adapt_all_clauses, _adapt_clause, _adapt_col_list, _adapt_polymorphic_element, _adjust_for_single_inheritance, _bind_mapper, _clone, _compile_context, _compound_eager_statement, _conditional_options, _connection_from_session, _entity_zero, _execute_and_instances, _from_selectable, _get_condition, _get_existing_condition, _get_impl, _get_options, _join, _join_left_to_right, _join_to_left, _joinpoint_zero, _mapper_loads_polymorphically_with, _mapper_zero, _no_clauseelement_condition, _no_criterion_assertion, _no_criterion_condition, _no_limit_offset, _no_statement_condition, _no_yield_per, _only_entity_zero, _only_full_mapper_zero, _only_mapper_zero, _options, _prepare_right_side, _reset_joinpoint, _reset_polymorphic_adapter, _set_enable_single_crit, _set_entities, _set_entity_selectables, _set_select_from, _should_log_debug, _should_log_info, _simple_statement, _update_joinpoint, _values, _with_current_path, _with_invoke_all_eagers

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from sqlalchemy.orm.query.Query: logger

Inherited from sqlalchemy.orm.query.Query (private): _attributes, _autoflush, _correlate, _criterion, _current_path, _distinct, _enable_assertions, _enable_eagerloads, _enable_single_crit, _execution_options, _filter_aliases, _for_update_arg, _from_obj, _from_obj_alias, _group_by, _having, _invoke_all_eagers, _join_entities, _joinpath, _joinpoint, _limit, _mapper_adapter_map, _offset, _only_load_props, _order_by, _orm_only_adapt, _orm_only_from_obj_alias, _params, _populate_existing, _prefixes, _refresh_state, _select_from_entity, _statement, _suffixes, _version_check, _with_hints, _with_labels, _with_options, _yield_per

Properties [hide private]

Inherited from sqlalchemy.orm.query.Query: column_descriptions, selectable, statement, whereclause

Inherited from sqlalchemy.orm.query.Query (private): _mapper_entities, _select_args, _should_nest_selectable

Inherited from object: __class__

Method Details [hide private]

paginate(self, page, per_page=20, error_out=True)

 
Returns `per_page` items from page `page`.  By default it will
abort with 404 if no items were found and the page was larger than
1.  This behavor can be disabled by setting `error_out` to `False`.

Returns an :class:`Pagination` object.