API Documentation¶
-
class
estoult.Association¶ Bases:
objectOne 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=[])¶
-
static
-
class
estoult.Database(autoconnect=True, *args, **kwargs)¶ Bases:
object-
atomic(commit=True)¶
-
close()¶
-
conn¶
-
connect()¶
-
cursor¶
-
get(query, params)¶
-
get_or_none(query, params)¶
-
insert(*args, **kwargs)¶
-
select(*args, **kwargs)¶
-
sql(*args, **kwargs)¶
-
-
class
estoult.Field(type, name=None, caster=None, null=True, default=None, primary_key=False)¶ Bases:
objectA 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)¶
-
classmethod
-
class
estoult.op¶ Bases:
object-
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
ne(*args)¶
-
static
not_(*args)¶
-
static
not_null(*args)¶
-
static
or_(lhs, rhs)¶
-
classmethod
-
class
estoult.Schema¶ Bases:
objectA schema representation of a database table.
Variables: allow_wildcard_select – Determines if wildcards can be used when ‘selecting’. -
allow_wildcard_select= True¶
-
classmethod
delete(row)¶
-
classmethod
delete_by_pk(id, new)¶
-
classmethod
insert(obj)¶
-
classmethod
update(old, new)¶
-
classmethod
update_by_pk(id, new)¶
-
-
class
estoult.qf(name)¶ Bases:
estoult.FieldQuery 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)¶
-