db Package

db Package

Database integration

query Module

class kiwi.db.query.DateIntervalQueryState(filter, start, end)[source]

Bases: kiwi.db.query.QueryState

Create a new DateIntervalQueryState object. :cvar start: start of interval :cvar end: end of interval

class kiwi.db.query.DateQueryState(filter, date)[source]

Bases: kiwi.db.query.QueryState

Create a new DateQueryState object. :cvar date: date

class kiwi.db.query.NumberIntervalQueryState(filter, start, end)[source]

Bases: kiwi.db.query.QueryState

Create a new NumberIntervalQueryState object. :cvar start: number :cvar end: number

class kiwi.db.query.NumberQueryState(filter, value)[source]

Bases: kiwi.db.query.QueryState

Create a new NumberQueryState object. :cvar value: number

class kiwi.db.query.QueryExecuter[source]

Bases: object

A QueryExecuter is responsible for taking the state (as in QueryState) objects from search filters and construct a query. How the query is constructed is ORM/DB-layer dependent.

Variables:default_search_limit – The default search limit.
default_search_limit = 1000
get_limit()[source]
search(states)[source]

Execute a search. :param states: :type states: list of QueryStates :returns: list of objects matching query

set_filter_columns(search_filter, columns)[source]
set_limit(limit)[source]

Set the maximum number of result items to return in a search query. :param limit:

class kiwi.db.query.QueryState(search_filter)[source]

Bases: object

class kiwi.db.query.StringQueryState(filter, text, mode=0)[source]

Bases: kiwi.db.query.QueryState

Create a new StringQueryState object. :cvar text: string

CONTAINS = 0
NOT_CONTAINS = 1

sqlalch Module

SQLAlchemy integration for Kiwi

class kiwi.db.sqlalch.SQLAlchemyQueryExecuter(session)[source]

Bases: kiwi.db.query.QueryExecuter

add_filter_query_callback(search_filter, callback)[source]

Adds a query callback for the filter search_filter

Parameters:
  • search_filter – a search filter
  • callback – a callable
add_query_callback(callback)[source]

Adds a generic query callback

Parameters:callback – a callable
search(states)[source]

Execute a search. :param states:

set_query(callback)[source]

Overrides the default query mechanism. :param callback: a callable which till take two arguments:

(query, connection)
set_table(table)[source]

Sets the SQLObject table/object for this executer :param table: a SQLObject subclass

sqlobj Module

stormintegration Module

Storm integration for Kiwi

class kiwi.db.stormintegration.StormQueryExecuter(conn)[source]

Bases: kiwi.db.query.QueryExecuter

Execute queries from a storm database

add_filter_query_callback(search_filter, callback)[source]

Adds a query callback for the filter search_filter

Parameters:
  • search_filter – a search filter
  • callback – a callable
add_query_callback(callback)[source]

Adds a generic query callback

Parameters:callback – a callable
search(states)[source]

Execute a search. :param states:

set_query(callback)[source]

Overrides the default query mechanism. :param callback: a callable which till take two arguments:

(query, connection)
set_table(table)[source]

Sets the Storm table/object for this executer :param table: a Storm table class

Table Of Contents

Previous topic

kiwi Package

Next topic

i18n Package

This Page