Results and errors#
Write report#
Engine.write returns a dictionary with these keys:
Key |
Meaning |
|---|---|
|
Rows committed. |
|
|
|
Rows the write was given that broke each row rule, keyed by rule: set aside under |
|
Rows set aside rather than committed. |
|
Under |
|
Files the write added. |
|
The contract’s row rules over the rows written. |
|
The dataset’s |
|
For an Iceberg table, the snapshot committed. |
Under the default refuse, a write given any row that breaks a row rule raises peql.Refused and writes nothing.
Validation verdict#
Engine.validate returns the verdict directly; Engine.write puts it under report["verdict"].
Key |
Meaning |
|---|---|
|
Whether deny-level quality checks passed. |
|
Number of rows evaluated. |
|
Failure counts keyed by assertion id. |
|
Contract requirements that failed. |
|
Results of dataset-level guarantees, decided only by |
|
Computed statistics used by rules. |
|
Hash of the validated data. |
A verdict can be valid even when a drop-level or report-only check fails.
Query envelope#
Engine.query_with_envelope returns (pyarrow.Table, dict). The dictionary has these keys:
Key |
Meaning |
|---|---|
|
Caller id, tenant and purpose supplied to the engine. |
|
Applied contract names, versions, hashes, rules and annotations. Each contract’s |
|
Returned row count. |
|
Active minimum group size, when applicable. |
|
Epsilon charged by this query, per budget. |
|
Remaining amounts for budgets this query charged. |
|
Row, Arrow-byte, file-byte and pruning counters. |
|
Query/result hashes and timestamp; a signature requires a configured signer. |
|
Matching audit entry identifier. |
|
Whether stored result batches were returned. |
Exceptions#
peql.Refused is the package’s alias for Python PermissionError. It covers engine-classified refusals including invisible or unknown contracts, denied callers, unservable data, failed guarantees, rows that break a row rule (a write under refuse, or a query under on_violation="refuse"), exhausted privacy budgets and unsupported SQL. Other native engine failures map to RuntimeError. Ordinary Python argument mistakes can raise TypeError or AttributeError before the engine is called. These exception classes have no peQL-specific fields.
try:
table, envelope = engine.query_with_envelope(sql, caller)
except peql.Refused as error:
print("Query refused:", error)