PgBeam Docs
Policies

DryEvalPolicy

Dry-eval a policy against a SQL statement

Evaluates a single SQL statement against a policy — either a draft policy supplied inline or an existing policy referenced by id — and returns the decision the proxy would make: allow, block, mask, or row-filter. The evaluation reuses the data plane's own policy engine (the same parser, allow/block rules, row-filter rewriter, and masking analysis enforced on live agent sessions), so a what-if verdict matches real enforcement. Stateful checks a single-statement preview cannot model — per-region query and egress budgets, human approvals, and rollback/sandbox write routing — are reported as informational notes, not verdicts. This is a pure compute endpoint; it does not connect to the upstream database and persists nothing.

Usage

result, err := client.Policies.DryEvalPolicy(ctx, "prj_xxx", pgbeam.DryEvalInput{
    SQL: "SELECT email FROM users WHERE id = 1",
  })

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
projectIDstringYesUnique project identifier (prefixed, e.g. prj_xxx).
reqpgbeam.DryEvalInputYesRequest body
req.SQLstringYesThe single SQL statement to evaluate.
req.PolicyID*stringNoID of an existing saved policy profile to evaluate against.
req.Policy*pgbeam.PolicyProfileInputNo

Response

(*pgbeam.DryEvalResult, error) — the dry-eval decision.

Example

import pgbeam "go.pgbeam.com/sdk"

client := pgbeam.NewClient(&pgbeam.ClientOptions{
  APIKey: "pgb_your_api_key",
})

result, err := client.Policies.DryEvalPolicy(ctx, "prj_xxx", pgbeam.DryEvalInput{
    SQL: "SELECT email FROM users WHERE id = 1",
    PolicyID: "pol_01h455vb4pex5vsknk084sn02q",
    Policy: pgbeam.PolicyProfileInput{ /* ... */ },
  })
if err != nil {
  log.Fatal(err)
}
fmt.Println(result)

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page