API Documentation

class estoult.Association

Bases: object

One to One/Many associations to help translate between relational data and object data.

Many to Many is currently not supported because it does not translate well into an object structure.

static has_many(schema, on=[])
static has_one(schema, on=[])
class estoult.Field(type, name=None, caster=None, null=True, default=None, primary_key=False)

Bases: object

A schema field, analogous to columns on a table.

Parameters:
  • type (type) – Basic datatype of the field, used to cast values into the database.
  • name (str, optional) – The column name of the field, will default to the variable name of the field.
  • caster (callable, optional) – A specified caster type/function for more extensive casting.
  • null (bool, optional) – Field allows nulls.
  • default (optional) – Default value.
  • primary_key (bool, optional) – Field is the primary key.
full_name
class estoult.fn

Bases: object

classmethod add_fn(name, sql_fn)

Adds an additional function to the module.

Parameters:
  • name (str) – What the name of the function should be called.
  • sql_fn (str) – The SQL function it is turned into.
static alias(lhs, rhs)
static avg(*args)
static cast(lhs, rhs)
static ceil(*args)
static concat(*args)
static count(*args)
static distinct(*args)
static max(*args)
static min(*args)
static sum(*args)
static wild(schema)

Select a schema with wildcard.

Parameters:schema (Schema) – The schema.
class estoult.MySQLDatabase(*args, **kwargs)

Bases: estoult.Database

mogrify(*args, **kwargs)
class estoult.op

Bases: object

static add(*args)
classmethod add_op(name, op)

Adds an operator to the module.

Parameters:
  • name (str) – What the name of the function should be called.
  • op (str) – The SQL operator it is turned into.
static and_(lhs, rhs)
static eq(*args)
static ge(*args)
static gt(*args)
static ilike(*args)
static in_(lhs, rhs)
static is_null(*args)
static le(*args)
static like(lhs, rhs)
static lt(*args)
static mod(*args)
static mul(*args)
static ne(*args)
static not_(*args)
static not_null(*args)
static or_(lhs, rhs)
static sub(*args)
static truediv(*args)
class estoult.PostgreSQLDatabase(*args, **kwargs)

Bases: estoult.Database

mogrify(*args, **kwargs)
class estoult.Schema

Bases: object

A schema representation of a database table.

Variables:_allow_wildcard_select – Determines if wildcards can be used when ‘selecting’.
classmethod delete(row)
classmethod delete_by_pk(id)
classmethod insert(obj)
classmethod update(old, new)
classmethod update_by_pk(id, new)
class estoult.SQLiteDatabase(*args, **kwargs)

Bases: estoult.Database

mogrify(*args, **kwargs)
class estoult.qf(name)

Bases: estoult.Field

Query field - an extra user defined field used for queries. This is mainly needed for referencing aliases.

Parameters:name (str) – The name of the field.
full_name
class estoult.Query(schema)

Bases: object

copy()
delete()
execute() → Any
full_join(schema, on)
full_outer_join(schema, on)
get(*args)
get_or_none(*args)
inner_join(schema, on)
left_join(schema, on)
left_outer_join(schema, on)
limit(*args)
order_by(*args)
preload(association)
right_join(schema, on)
right_outer_join(schema, on)
select(*args)
union(schema)
update(changeset)
where(*clauses)