Skip to main content
POST
Generate a code change for an insight

Authorizations

Authorization
string
header
required

Organization API key (sl_…).

Headers

x-tenant-id
string
required

The organization ID the request is scoped to.

Body

application/json

The query to optimize, and which of its opportunities to act on.

query_id
string
required

The Snowflake query id of the query to rewrite. The query must have run in the last 14 days for its execution profile to still be available.

query_insight_type
enum<string>
required

Which optimization opportunity to generate a rewrite for.

Available options:
query-pruning,
incremental-query-pruning,
incrementalize-dbt-query,
incrementalize-ctas-query,
inefficient-cortex-function-usage

Response

Successful Response

A suggested rewrite of a query.

new_code
string | null

The rewritten query. Null when no rewrite is being suggested: either the optimization does not apply to this query, or no rewrite was found that improves it.

description
string | null

What the rewrite changes, where the change needs explaining.

request_id
string | null

Identifier for this generation. Quote it when reporting a problem with the suggested rewrite.