Model

The model binds everything together (and might form the actual model of your MVC app). You don’t have to use this, but it is highly encouraged.

Reference

class sparrow.model.SparrowModel(ioloop, db_args, classes, debug=True, db=None, set_global_db=False)[source]

Bases: object

The central class that keeps everything together.

add_sql_statement(stat: sparrow.sql.Sql)[source]

Add an Sql that you want printed on info().

all_sql_statements()[source]

Return all Sql statements that have been added or are automatically generated.

install()[source]

Set up database, only once for each “install” of the model

json_info()[source]

Print all JSON info (as organized as possible). Send this to frontend devs.

sql_for_class(cls)[source]
sql_info()[source]

Print all SQL statements (as organized as possible).

uninstall()[source]

Very brutal operation, drops all tables.

sparrow.model.indent(s, i=4, code=True)[source]
sparrow.model.inline(s)[source]