Context

class dbload.context.Context[source]

Execution context.

Context holds within itself all registered scenarios, queries, and plays. It assembles these objects both from annotated text files with SQL queries and from Python files with decorated objects and functions.

scenarios

Dictionary of parsed and generated scenarios.

Type

Mapz

queries

Dictionary of parsed queries.

Type

Mapz

Examples

Create a new context:

from dbload import Context
context = Context()
register_query(query: function, name: Optional[str] = None, match: Optional[str] = None, auto: bool = False)None[source]

Register a query in the context.

register_scenario(scenario: function, name: Optional[str] = None, infuse: bool = False, auto: bool = False, auto_run_queries: List[str] = [])None[source]

Register a scneario in the context.

infuse()None[source]