business_rules
etl_craft.engine.repository.business_rules ¶
Business rules: the rules a task runs, their run log and the keys they flag.
BusinessRule
dataclass
¶
One active business rule of a task.
RuleRunBinding
dataclass
¶
A rule's run-log row under a task run, and whether it already succeeded there.
fetch_business_rules_for_task ¶
Return the active business rules of task_id, in the order they run.
begin_rule_run ¶
begin_rule_run(conn: Connection, business_rule_id: int, task_run_id: int, now: datetime) -> RuleRunBinding
Bind business_rule_id to task_run_id: its existing row, or a new one.
An existing row that did not succeed starts another attempt, IN-PROGRESS again.
finish_rule_run ¶
End a rule's run-log row with status.
fetch_active_rule_keys ¶
Return the keys business_rule_id currently flags.
flag_rule_keys ¶
flag_rule_keys(conn: Connection, rule: BusinessRule, business_rule_run_id: int, keys: Sequence[str], now: datetime) -> None
Flag keys for rule, found by business_rule_run_id.
clear_rule_keys ¶
clear_rule_keys(conn: Connection, business_rule_id: int, keys: Sequence[str], now: datetime) -> None
Clear active flags in batches of at most 1,000 keys on the caller's transaction.