Skip to content

Result Policies

Result policies control what happens to query results after execution — how long they’re kept, how they’re delivered, and who can access them.

Result policies are managed via server.toml (config-managed since v0.1.5):

[[result_policies]]
database = "app"
environment = "production"
retention_days = 7
delivery_mode = "both"
access = ["role:admin", "role:requester"]

Changes take effect on server restart or dbward-server reload.

FieldTypeDefaultDescription
databaseStringDatabase scope (or * for all)
environmentStringEnvironment scope (or * for all)
retention_daysInteger30Days to keep stored results
delivery_modeString"both"How results are delivered
accessString[][]Selectors for who can access results
ModeBehavior
bothStream result to client AND store on server
streamStream to client but don’t persist on server

The access field uses selectors to define who can retrieve stored results:

{
"access": [
"role:admin",
"group:backend-team",
"user:alice",
"requester"
]
}

"requester" means the user who submitted the original request.

Separate from per-policy retention, the server has global defaults in [retention]:

[retention]
request_ttl_days = 90 # How long request records are kept
audit_ttl_days = 365 # How long audit log entries are kept
result_ttl_days = 30 # Default result retention (overridden by policy)
approval_ttl_secs = 86400 # Seconds before approved requests expire

Users can share results with others using --share-with at execution time:

Terminal window
dbward execute --share-with "group:backend-team" "SELECT * FROM metrics"

This creates access grants in addition to the policy’s default access list.