This feature is only available in the Enterprise version

Data lake

Update saved query

Update the name, SQL, or date range of a saved lake query.

PATCH/data/lake/queries/{query_id}

Update a saved lake query. Send only the fields you want to change. Changing the SQL or date range does not rewrite past query runs. Those runs keep the snapshot from when they executed.

Only the query owner or an admin can update it.

If you change range_mode to fixed, send start_date and end_date. If you change it to rolling, send rolling_days.

Enterprise authentication

Send these requests to https://api.cloud.blnkfinance.com on Blnk Cloud. On a self-hosted Enterprise deployment, send them to ENTERPRISE_PUBLIC_URL.

Pass an Enterprise API key, or an OAuth access token, in the X-blnk-key header. Create the key in Enterprise API keys, or issue a token with Enterprise OAuth.

This credential comes from the Cloud or Enterprise workspace. A Core API key belongs to the Core instance.

X-blnk-keystringrequiredheader

Enterprise API key, or an OAuth access token.

Path

query_idstringrequiredpath

Unique id of the saved query (lake_query_...). Get it from List saved queries or Get saved query.

Body

instance_idstringbody

Unique id of the instance (instance_...). Get it from get instance details. Do not pass deployment_id. Send this to move the query to a different instance in the same workspace.

namestringbody

Replacement label shown in Insights and copied onto later query runs. Maximum 160 characters.

descriptionstringbody

Replacement note about what the query returns. Maximum 1000 characters.

sqlstringbody

Replacement read-only DuckDB SELECT or WITH. Same table and statement rules as Create new query. Later runs use this SQL. Past runs keep the old snapshot.

range_modestringbody

How Cloud should pick the lake date range on later runs. fixed uses start_date and end_date. rolling uses the last rolling_days days, resolved at run time.

start_datestringbody

First day of lake history. Required when you set range_mode to fixed. ISO date or datetime.

end_datestringbody

Last day of lake history. Required when you set range_mode to fixed. Must be after start_date.

rolling_daysintegerbody

Number of days of lake history Cloud opens on later runs (1 to 3650). Required when you set range_mode to rolling. Cloud resolves the window at run time.

Response

idstring

Unique id of this saved query (lake_query_...).

instance_idstring

Unique id of the instance (instance_...) this query is bound to after the update.

owner_user_idstring

User who created the query. The owner does not change when you update other fields.

namestring

Current label after the update.

descriptionstring

Current note after the update.

sqlstring

Current SELECT or WITH after the update. Later runs use this SQL.

range_modestring

How Cloud picks the lake date range on later runs: fixed or rolling.

start_datetimestamp

First day of lake history for a fixed query. Omitted when range_mode is rolling.

end_datetimestamp

Last day of lake history for a fixed query. Omitted when range_mode is rolling.

rolling_daysinteger

Number of days of lake history to open when range_mode is rolling. 0 when the query is fixed.

created_attimestamp

When the saved query was first created. This does not change on update.

updated_attimestamp

When this update was applied.