Custom queries (GraphQL)

Related queries and mutations in Integrations and connections. Each has its own section.

Queries

runCustomQuery (query)

runCustomQuery is a query in the Monte Carlo GraphQL API, in Integrations and connections. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Run a SQL query. Results will only be returned if sampling is enabled and allowed for the current user.

Arguments

ArgumentTypeDescription
dwIdUUIDwarehouse UUID
connectionIdUUIDconnection UUID
queryString
variablesJSONStringIf the query is using variables, values to use when running the query.
queryResultTypeQueryResultTypeQuery result type. Pass a value if you want to validate the query conforms to the expected result type before returning a result. By default, it returnsa COUNT(*) of the provided query.

Returns

SQLResponse

Example

query RunCustomQuery {
  runCustomQuery {
    columns
    rows
    hasCustomSqlFilter
    query
    hasError
    error
    samplingDisabled
    samplingRestricted
    contentWithheldReason
    rateLimitExceeded
    idempotentStatus
    downloadUrl
    queryExecutionId
  }
}

Related types

JSONString, QueryResultType, SQLResponse, UUID

runCustomRestRequest (query)

runCustomRestRequest is a query in the Monte Carlo GraphQL API, in Integrations and connections. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Run a REST API request against the warehouse connection's platform API (e.g. the Snowflake REST API, including Cortex Agents). The request is executed by the data collector using the connection's credentials, and the target host always derives from the connection itself — only a relative path can be provided. The request will not be executed and results will be withheld if the warehouse has granular data sampling configured or if the current user does not have access to raw customer data. Currently supported for Snowflake connections only.

Arguments

ArgumentTypeDescription
dwIdUUIDwarehouse UUID
connectionIdUUIDconnection UUID
methodRestRequestMethod!HTTP method.
pathString!Relative API path starting with '/', e.g. /api/v2/databases/DB/schemas/SCH/agents/MY_AGENT:run
bodyJSONStringJSON request body (for POST requests).
responseFormatRestResponseFormatHow the response is interpreted: JSON passes the payload through (default); SSE consumes the event stream and returns a parsed event list.

Returns

RestRequestResponse

Example

query RunCustomRestRequest($method: RestRequestMethod!, $path: String!) {
  runCustomRestRequest(method: $method, path: $path) {
    statusCode
    response
    events
    hasError
    error
    samplingDisabled
    idempotentStatus
  }
}

Types used only by runCustomRestRequest

RestRequestMethod

Enum type.

ValueDescription
GET
POST
RestRequestResponse

Object type.

FieldTypeDescription
statusCodeIntHTTP status code returned by the platform API.
responseJSONStringRaw JSON response payload (when responseFormat is JSON).
eventsJSONStringParsed list of server-sent events (when responseFormat is SSE); incremental delta events are filtered out.
hasErrorBooleanIf true, an error occurred while executing the request; the error field might include additional details.
errorStringAn error description if an error occurred while executing the request.
samplingDisabledBooleanIndicates the request was not executed and results were withheld: either the warehouse has granular data sampling configured (REST requests cannot be checked per-table) or the current user does not have access to raw customer data.
idempotentStatusIdempotentStatus
RestResponseFormat

Enum type.

ValueDescription
JSON
SSE

Related types

IdempotentStatus, JSONString, UUID

Source: The GraphQL API reference

This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.