Skip to main content

read_data_product

Function read_data_product 

Source
async fn read_data_product(
    client: &mut AuthedClient,
    name: &str,
    limit: u32,
    cluster_override: Option<&str>,
    max_response_size: usize,
) -> Result<McpResult, McpRequestError>
Expand description

Read rows from a data product. Issues a single read-only query.

The read routes to the cluster recorded in mz_mcp_data_products.cluster when the role has USAGE on it, so reads of indexed objects hit the index’s in-memory arrangement. That column is null when the role lacks USAGE on the object’s cluster (DEX-66); in that case, and absent an override, the read runs on the session’s default (serving) cluster instead. Only materialized views can appear this way, since plain views without at least one usable index cluster are excluded from mz_mcp_data_products entirely; the fallback is therefore safe (materialized views serve from persist without recompute).

cluster_override forces the read onto a named cluster instead — useful for a differently-sized or differently-replicated cluster.

The name is expected to come from get_data_products() / get_data_product_details(). The query runs inside a READ ONLY transaction, preventing mutations.