Skip to main content

build_read_query

Function build_read_query 

Source
fn build_read_query(
    safe_name: &str,
    limit: u32,
    target_cluster: Option<&str>,
) -> String
Expand description

Builds the SQL the agent runs for read_data_product.

safe_name must already be the validated, quoted form produced by safe_data_product_name. When target_cluster is Some, it is escaped as a SQL string literal and wrapped in SET CLUSTER inside the BEGIN READ ONLY transaction so the cluster choice is scoped to this read and does not leak into the session. When it is None, no SET CLUSTER is emitted and the read runs on the session’s default (serving) cluster.