Rules and custom SQL, part 1 of 2 (GraphQL)

Related queries and mutations in Monitors. Each has its own section.

Queries

getCircuitBreakerRuleState (query)

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

Status: Deprecated: Use GetCircuitBreakerRuleStateV2 instead to support rules with multiple executions

State for the circuit breaker rule job execution

Arguments

ArgumentTypeDescription
jobExecutionUuidUUID!The UUID of the job execution to get the state for

Returns

CircuitBreakerState

Example

query GetCircuitBreakerRuleState($jobExecutionUuid: UUID!) {
  getCircuitBreakerRuleState(jobExecutionUuid: $jobExecutionUuid) {
    jobExecutionUuid
    accountUuid
    resourceUuid
    customRuleUuid
    status
    log
  }
}

Related types

CircuitBreakerState, UUID

getCircuitBreakerRuleStateV2 (query)

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

State for the circuit breaker rule job executions

Arguments

ArgumentTypeDescription
jobExecutionUuids[UUID]!The UUIDs of the job executions to get the state for

Returns

[CircuitBreakerState]

Example

query GetCircuitBreakerRuleStateV2($jobExecutionUuids: [UUID]!) {
  getCircuitBreakerRuleStateV2(jobExecutionUuids: $jobExecutionUuids) {
    jobExecutionUuid
    accountUuid
    resourceUuid
    customRuleUuid
    status
    log
  }
}

Related types

CircuitBreakerState, UUID

getCustomRule (query)

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

Get a custom rule

Arguments

ArgumentTypeDescription
ruleIdUUIDRule id
descriptionContainsStringString to completely or partially match the rule description, case-insensitive
customSqlContainsStringString to completely or partially match the rule SQL, case-insensitive

Returns

CustomRule

Example

query GetCustomRule {
  getCustomRule {
    id
    createdTime
    updatedTime
    uuid
    accountUuid
    projects
    datasets
    isDeleted
    deletedAt
    description
    notes
    labels
    failureAudiences
    isTemplateManaged
    namespace
    priority
    isPaused
    pausedReason
    isDraft
    isAutoCreated
  }
}

Related types

CustomRule, UUID

getCustomRuleExecutionAnalytics (query)

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

Return analytics for the executions of the custom rules

Arguments

ArgumentTypeDescription
ruleIdUUID!Rule id
startTimeDateTime!Beginning of time range to calculate the execution analytics
endTimeDateTimeEnd of time range to calculate the execution analytics
timezoneStringTimezone to apply when grouping by date
groupByPeriodGrouping!Time buckets to group time-bound analytics by.

Returns

[CustomRuleExecutionAnalytics!]!

Example

query GetCustomRuleExecutionAnalytics($ruleId: UUID!, $startTime: DateTime!, $groupBy: PeriodGrouping!) {
  getCustomRuleExecutionAnalytics(ruleId: $ruleId, startTime: $startTime, groupBy: $groupBy) {
    date
    runs
    passes
    breaches
  }
}

Types used only by getCustomRuleExecutionAnalytics

CustomRuleExecutionAnalytics

Object type.

FieldTypeDescription
dateDateTime!Date for the analytics, if grouped by week/month it has the start of each grouping period
runsInt!Number of runs
passesInt!Number of passes
breachesInt!Number of breaches

Related types

DateTime, PeriodGrouping, UUID

getCustomRules (query)

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

Arguments

ArgumentTypeDescription
entityMcons[String]Return rules associated with any of these table MCONs
metadataKeys[String]Return rules with all these keys in their metadata
offsetInt
beforeString
afterString
firstInt
lastInt
ruleTypeCustomRuleModelRuleType
warehouseUuidUUID

Returns

CustomRuleConnection

Example

query GetCustomRules {
  getCustomRules {
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}

Related types

CustomRuleConnection, CustomRuleModelRuleType, UUID

getCustomSqlTemplates (query)

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

Get all active Custom SQL Templates

Arguments

ArgumentTypeDescription
queryResultTypeFilterQueryResultTypeCustomSQLTemplate's query result type can be set to SINGLE_NUMERIC, ROW_COUNT and LABELED_NUMERICS. The filter is None then all templates are returned
offsetInt
beforeString
afterString
firstInt
lastInt
uuidUUID
nameString
descriptionString
sqlTemplateString
dialectString
queryResultTypeCustomSQLTemplateModelQueryResultType

Returns

CustomSQLTemplateConnection

Example

query GetCustomSqlTemplates {
  getCustomSqlTemplates {
    totalCount
    edgeCount
  }
}

Related types

CustomSQLTemplateConnection, CustomSQLTemplateModelQueryResultType, QueryResultType, UUID

getFieldMetricQuery (query)

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

Status: Deprecated: DEPRECATED: Use Custom SQL monitors instead.

DEPRECATED: Build field quality rule query from parameters

Arguments

ArgumentTypeDescription
fieldMetricFieldMetricInput!field quality rule query parameters

Returns

FieldMetricQuery

Example

query GetFieldMetricQuery($fieldMetric: FieldMetricInput!) {
  getFieldMetricQuery(fieldMetric: $fieldMetric) {
    sqlQuery
  }
}

Types used only by getFieldMetricQuery

FieldMetricQuery

Object type.

FieldTypeDescription
sqlQueryStringSQL query for the metric

Related types

FieldMetricInput

getFieldQuery (query)

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

Status: Deprecated: DEPRECATED: Use Custom SQL monitors instead.

Build field quality rule SQL query from parameters

Arguments

ArgumentTypeDescription
fieldQueryParametersFieldQueryParametersInput!Field quality rule query parameters

Returns

FieldQuery

Example

query GetFieldQuery($fieldQueryParameters: FieldQueryParametersInput!) {
  getFieldQuery(fieldQueryParameters: $fieldQueryParameters) {
    sqlQuery
    variables
  }
}

Types used only by getFieldQuery

FieldQuery

Object type.

FieldTypeDescription
sqlQueryStringSQL query
variablesJSONStringPossible variable values for SQL query

Related types

FieldQueryParametersInput, JSONString

getGeneratedRules (query)

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

Arguments

ArgumentTypeDescription
generatedByUuidUUIDParent CustomRule UUID

Returns

[CustomRule]

Example

query GetGeneratedRules {
  getGeneratedRules {
    id
    createdTime
    updatedTime
    uuid
    accountUuid
    projects
    datasets
    isDeleted
    deletedAt
    description
    notes
    labels
    failureAudiences
    isTemplateManaged
    namespace
    priority
    isPaused
    pausedReason
    isDraft
    isAutoCreated
  }
}

Related types

CustomRule, UUID

getNotificationSettingsForRulesWith (query)

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

Status: Deprecated: Use getNotificationSettingsForAudience instead

DEPRECATED. The notification settings that will be used in a rule with the specified data

Arguments

ArgumentTypeDescription
ruleTypeString!Rule type.
warehouseUuidUUID!Warehouse UUID.
fullTableIds[String]Full table ids.
labelNames[String]Monitor labels.

Returns

[AccountNotificationSetting]

Example

query GetNotificationSettingsForRulesWith($ruleType: String!, $warehouseUuid: UUID!) {
  getNotificationSettingsForRulesWith(ruleType: $ruleType, warehouseUuid: $warehouseUuid) {
    id
    deletedAt
    uuid
    createdTime
    lastUpdateTime
    name
    isTemplateManaged
    namespace
    type
    recipients
    extra
    notificationScheduleType
    notificationEnabled
    recipientDisplayName
    recipientsDisplayNames
    permalink
    alertSubTypes
    customMessage
    integrationId
    channelUrl
  }
}

Related types

AccountNotificationSetting, UUID

getQueryTemplate (query)

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

Status: Deprecated: DEPRECATED: Use Validation monitors instead for referential integrity checks.

DEPRECATED. Gets a query template

Arguments

ArgumentTypeDescription
queryTemplateIdString!ID for the template used to generate this query
warehouseUuidUUIDUUID for the warehouse where the run will be executed
variableValues[QueryTemplateVariableValueInput!]Values for the template variables. If not provided, the template source will be returned

Returns

QueryTemplateOutput

Example

query GetQueryTemplate($queryTemplateId: String!) {
  getQueryTemplate(queryTemplateId: $queryTemplateId) {
    id
    sqlQuery
  }
}

Types used only by getQueryTemplate

QueryTemplateOutput

Object type.

FieldTypeDescription
idStringThe template ID
sqlQueryStringThe SQL query template
variables[QueryTemplateVariable]Variables for the query
QueryTemplateVariable

Object type.

FieldTypeDescription
nameStringVariable name

Related types

QueryTemplateVariableValueInput, UUID

getRunSqlRuleState (query)

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

State for the sql rule job executions

Arguments

ArgumentTypeDescription
jobExecutionUuids[UUID]!The UUID of the job execution to get the state for

Returns

[CircuitBreakerState]

Example

query GetRunSqlRuleState($jobExecutionUuids: [UUID]!) {
  getRunSqlRuleState(jobExecutionUuids: $jobExecutionUuids) {
    jobExecutionUuid
    accountUuid
    resourceUuid
    customRuleUuid
    status
    log
  }
}

Related types

CircuitBreakerState, UUID

getTablesForSql (query)

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

The full table ids calculated from the sql query

Arguments

ArgumentTypeDescription
warehouseUuidUUID!Warehouse UUID.
customSqlString!Custom SQL query to run
customSamplingSqlStringCustom sampling SQL query to run on breach
variablesJSONStringPossible variable values for SQL query

Returns

[SqlQueryTable]

Example

query GetTablesForSql($warehouseUuid: UUID!, $customSql: String!) {
  getTablesForSql(warehouseUuid: $warehouseUuid, customSql: $customSql) {
    fullTableId
    mcon
  }
}

Types used only by getTablesForSql

SqlQueryTable

Object type.

FieldTypeDescription
fullTableIdStringFull table id of the table
mconStringMCONs of the table

Related types

JSONString, UUID

Mutations

createCustomMetricRule (mutation)

createCustomMetricRule is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Deprecated: Use CreateOrUpdateCustomSqlRule instead.

Deprecated, use CreateOrUpdateCustomMetricRule instead

Arguments

ArgumentTypeDescription
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
autoTriageBooleanPer-monitor automated-triage override. true forces triage on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
comparisons[CustomRuleComparisonInput]!Custom rule comparisons
connectionIdUUIDSpecify a connection (e.g. query-engine) to use
customRuleUuidUUIDUUID of custom rule, to update existing rule
customSamplingSqlStringCustom sampling SQL query to run on breach
customSqlString!Custom SQL query to run
dataQualityDimensionStringData quality dimension on the custom rule.
descriptionString!Description of rule
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dwIdUUID!Warehouse UUID
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringSpecifies the column which contains the primary key for sampled data used in exception management.
failOnResetBooleanReturn an error if the update is a significant change that would require a monitor reset. Default: false.
failureAudiences[String!]The audiences to notify on failure
fieldMetricFieldMetricInput(DEPRECATED). Use standard Custom SQL monitors instead.
fieldQueryParametersFieldQueryParametersInput(DEPRECATED). Use Validation monitors instead for cardinality checks.
intervalMinutesIntHow often to run scheduled custom rule check (DEPRECATED, use schedule instead)
labels[String]The monitor labels
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
priorityStringThe default priority for alerts involving this monitor
queryResultTypeQueryResultTypeHow the query result is used for the metric. Uses row count if unset.
queryTemplateIdString(DEPRECATED). Use Validation monitors instead for referential integrity checks.
queryTemplateVariableValues[QueryTemplateVariableValueInput!](DEPRECATED). Use Validation monitors instead for referential integrity checks.
scheduleConfigScheduleConfigInputSchedule of custom rule
severityStringDEPRECATED. Use priority instead. The default severity for incidents involving this monitor Default: "".
skipResetBooleanDo not reset monitor if the update is a significant change that would normally cause the monitor to be reset. Learned model might not match the new monitor configuration and false positives might be detected for up to 35 days Default: false.
startTimeDateTimeStart time of schedule (DEPRECATED, use schedule instead)
tags[TagKeyValuePairInput]The monitor tags.
timeoutIntTimeout for the SQL query
timezoneStringTimezone (DEPRECATED, use timezone in scheduleConfig instead
variableDefinitions[VariableDefinitionInput!]Possible variable values for SQL query. Allows specifying runtime variables as well.
variablesJSONStringPossible variable values for SQL query. Only to specify static variables.

Returns

CreateCustomMetricRule

Example

mutation CreateCustomMetricRule($comparisons: [CustomRuleComparisonInput]!, $customSql: String!, $description: String!, $dwId: UUID!) {
  createCustomMetricRule(comparisons: $comparisons, customSql: $customSql, description: $description, dwId: $dwId) {
    customRule {
      id
      createdTime
      updatedTime
      uuid
      accountUuid
      projects
      datasets
      isDeleted
      deletedAt
      description
      notes
      labels
      failureAudiences
      isTemplateManaged
      namespace
      priority
      isPaused
      pausedReason
      isDraft
      isAutoCreated
    }
  }
}

Types used only by createCustomMetricRule

CreateCustomMetricRule

Object type. Deprecated, use CreateOrUpdateCustomMetricRule instead

FieldTypeDescription
customRuleCustomRule

Related types

AlertGroupingInput, AudienceConditionInput, CustomRule, CustomRuleComparisonInput, DateTime, FieldMetricInput, FieldQueryParametersInput, JSONString, QueryResultType, QueryTemplateVariableValueInput, ScheduleConfigInput, TagKeyValuePairInput, UUID, VariableDefinitionInput

createCustomRule (mutation)

createCustomRule is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Deprecated: Depending on the type of monitor you would like to create, use CreateOrUpdateVolumeRule, CreateOrUpdateFreshnessCustomRule, CreateOrUpdateCustomSqlRule, CreateOrUpdateComparisonRule or CreateOrUpdateQueryPerfRule instead.

Deprecated, use CreateOrUpdateCustomRule instead

Arguments

ArgumentTypeDescription
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
comparisons[CustomRuleComparisonInput]!Custom rule comparisons
customRuleUuidUUIDUUID of custom rule, to update existing rule
dataQualityDimensionStringData quality dimension on the custom rule.
descriptionStringUsed as the name in the UI
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dwIdUUIDWarehouse the tables are contained in. Required when using fullTableIds
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringSpecifies the column which contains the primary key for sampled data used in exception management.
failureAudiences[String!]The audiences to notify on failure
intervalMinutesIntHow often to run scheduled custom rule check (DEPRECATED, use schedule instead)
labels[String]The monitor labels
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
priorityStringThe default priority for alerts involving this monitor
scheduleConfigScheduleConfigInputSchedule of custom rule
severityStringDEPRECATED. Use priority instead. The default severity for incidents involving this monitor Default: "".
startTimeDateTimeStart time of schedule (DEPRECATED, use schedule instead)
tags[TagKeyValuePairInput]The monitor tags.
timezoneStringTimezone (DEPRECATED, use timezone in scheduleConfig instead

Returns

CreateCustomRule

Example

mutation CreateCustomRule($comparisons: [CustomRuleComparisonInput]!) {
  createCustomRule(comparisons: $comparisons) {
    customRule {
      id
      createdTime
      updatedTime
      uuid
      accountUuid
      projects
      datasets
      isDeleted
      deletedAt
      description
      notes
      labels
      failureAudiences
      isTemplateManaged
      namespace
      priority
      isPaused
      pausedReason
      isDraft
      isAutoCreated
    }
  }
}

Types used only by createCustomRule

CreateCustomRule

Object type. Deprecated, use CreateOrUpdateCustomRule instead

FieldTypeDescription
customRuleCustomRule

Related types

AlertGroupingInput, AudienceConditionInput, CustomRule, CustomRuleComparisonInput, DateTime, ScheduleConfigInput, TagKeyValuePairInput, UUID

createOrUpdateComparisonRule (mutation)

createOrUpdateComparisonRule is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Create or update a comparison monitor

Arguments

ArgumentTypeDescription
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
autoTriageBooleanPer-monitor automated-triage override. true forces triage on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
comparisons[CustomRuleComparisonInput]!Custom rule comparisons
customRuleUuidUUIDUUID of custom rule, to update existing rule
dataQualityDimensionStringData quality dimension on the custom rule.
descriptionString!Description of rule
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dryRunBooleanDry run the monitor creation or update and return the MaC YAML and queries. Default: false.
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringSpecifies the column which contains the primary key for sampled data used in exception management.
failureAudiences[String!]The audiences to notify on failure
labels[String]The monitor labels
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
priorityStringThe default priority for alerts involving this monitor
queryResultTypeQueryResultType!Specifies query result format for generating metrics
scheduleConfigScheduleConfigInput!Schedule of custom rule
severityStringDEPRECATED. Use priority instead. The default severity for incidents involving this monitor Default: "".
sourceConnectionIdUUIDConnection (i.e. query-engine) to use for source query
sourceDwIdUUID!Warehouse UUID for source query
sourceSqlQueryString!Query to generate source metric
tags[TagKeyValuePairInput]The monitor tags.
targetConnectionIdUUIDConnection (i.e. query-engine) to use for target query
targetDwIdUUID!Warehouse UUID for target query
targetSqlQueryString!Query to generate target metric

Returns

CreateOrUpdateComparisonRule

Example

mutation CreateOrUpdateComparisonRule($comparisons: [CustomRuleComparisonInput]!, $description: String!, $queryResultType: QueryResultType!, $scheduleConfig: ScheduleConfigInput!, $sourceDwId: UUID!, $sourceSqlQuery: String!, $targetDwId: UUID!, $targetSqlQuery: String!) {
  createOrUpdateComparisonRule(comparisons: $comparisons, description: $description, queryResultType: $queryResultType, scheduleConfig: $scheduleConfig, sourceDwId: $sourceDwId, sourceSqlQuery: $sourceSqlQuery, targetDwId: $targetDwId, targetSqlQuery: $targetSqlQuery) {
    yaml
    queries
  }
}

Types used only by createOrUpdateComparisonRule

CreateOrUpdateComparisonRule

Object type. Create or update a comparison rule

FieldTypeDescription
customRuleCustomRule
yamlString
queries[String!]SQL queries that will be run by the monitor on each execution.

Related types

AlertGroupingInput, AudienceConditionInput, CustomRule, CustomRuleComparisonInput, QueryResultType, ScheduleConfigInput, TagKeyValuePairInput, UUID

createOrUpdateCustomMetricRule (mutation)

createOrUpdateCustomMetricRule is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Deprecated: Use CreateOrUpdateCustomSqlRule instead.

Create or update a custom metric rule

Arguments

ArgumentTypeDescription
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
autoTriageBooleanPer-monitor automated-triage override. true forces triage on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
comparisons[CustomRuleComparisonInput]!Custom rule comparisons
connectionIdUUIDSpecify a connection (e.g. query-engine) to use
customRuleUuidUUIDUUID of custom rule, to update existing rule
customSamplingSqlStringCustom sampling SQL query to run on breach
customSqlString!Custom SQL query to run
dataQualityDimensionStringData quality dimension on the custom rule.
descriptionString!Description of rule
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dwIdUUID!Warehouse UUID
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringSpecifies the column which contains the primary key for sampled data used in exception management.
failOnResetBooleanReturn an error if the update is a significant change that would require a monitor reset. Default: false.
failureAudiences[String!]The audiences to notify on failure
fieldMetricFieldMetricInput(DEPRECATED). Use standard Custom SQL monitors instead.
fieldQueryParametersFieldQueryParametersInput(DEPRECATED). Use Validation monitors instead for cardinality checks.
intervalMinutesIntHow often to run scheduled custom rule check (DEPRECATED, use schedule instead)
labels[String]The monitor labels
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
priorityStringThe default priority for alerts involving this monitor
queryResultTypeQueryResultTypeHow the query result is used for the metric. Uses row count if unset.
queryTemplateIdString(DEPRECATED). Use Validation monitors instead for referential integrity checks.
queryTemplateVariableValues[QueryTemplateVariableValueInput!](DEPRECATED). Use Validation monitors instead for referential integrity checks.
scheduleConfigScheduleConfigInputSchedule of custom rule
severityStringDEPRECATED. Use priority instead. The default severity for incidents involving this monitor Default: "".
skipResetBooleanDo not reset monitor if the update is a significant change that would normally cause the monitor to be reset. Learned model might not match the new monitor configuration and false positives might be detected for up to 35 days Default: false.
startTimeDateTimeStart time of schedule (DEPRECATED, use schedule instead)
tags[TagKeyValuePairInput]The monitor tags.
timeoutIntTimeout for the SQL query
timezoneStringTimezone (DEPRECATED, use timezone in scheduleConfig instead
variableDefinitions[VariableDefinitionInput!]Possible variable values for SQL query. Allows specifying runtime variables as well.
variablesJSONStringPossible variable values for SQL query. Only to specify static variables.

Returns

CreateOrUpdateCustomMetricRule

Example

mutation CreateOrUpdateCustomMetricRule($comparisons: [CustomRuleComparisonInput]!, $customSql: String!, $description: String!, $dwId: UUID!) {
  createOrUpdateCustomMetricRule(comparisons: $comparisons, customSql: $customSql, description: $description, dwId: $dwId) {
    customRule {
      id
      createdTime
      updatedTime
      uuid
      accountUuid
      projects
      datasets
      isDeleted
      deletedAt
      description
      notes
      labels
      failureAudiences
      isTemplateManaged
      namespace
      priority
      isPaused
      pausedReason
      isDraft
      isAutoCreated
    }
  }
}

Types used only by createOrUpdateCustomMetricRule

CreateOrUpdateCustomMetricRule

Object type. Create or update a custom metric rule

FieldTypeDescription
customRuleCustomRule

Related types

AlertGroupingInput, AudienceConditionInput, CustomRule, CustomRuleComparisonInput, DateTime, FieldMetricInput, FieldQueryParametersInput, JSONString, QueryResultType, QueryTemplateVariableValueInput, ScheduleConfigInput, TagKeyValuePairInput, UUID, VariableDefinitionInput

createOrUpdateCustomRule (mutation)

createOrUpdateCustomRule is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Deprecated: Depending on the type of monitor you would like to create, use CreateOrUpdateVolumeRule, CreateOrUpdateFreshnessCustomRule, CreateOrUpdateCustomSqlRule, CreateOrUpdateComparisonRule or CreateOrUpdateQueryPerfRule instead.

DEPRECATED. Depending on the type of monitor you would like to create, use CreateOrUpdateVolumeRule, CreateOrUpdateFreshnessCustomRule, CreateOrUpdateCustomSqlRule, CreateOrUpdateComparisonRule or CreateOrUpdateQueryPerfRule instead.

Arguments

ArgumentTypeDescription
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
comparisons[CustomRuleComparisonInput]!Custom rule comparisons
customRuleUuidUUIDUUID of custom rule, to update existing rule
dataQualityDimensionStringData quality dimension on the custom rule.
descriptionStringUsed as the name in the UI
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dwIdUUIDWarehouse the tables are contained in. Required when using fullTableIds
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringSpecifies the column which contains the primary key for sampled data used in exception management.
failureAudiences[String!]The audiences to notify on failure
intervalMinutesIntHow often to run scheduled custom rule check (DEPRECATED, use schedule instead)
labels[String]The monitor labels
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
priorityStringThe default priority for alerts involving this monitor
scheduleConfigScheduleConfigInputSchedule of custom rule
severityStringDEPRECATED. Use priority instead. The default severity for incidents involving this monitor Default: "".
startTimeDateTimeStart time of schedule (DEPRECATED, use schedule instead)
tags[TagKeyValuePairInput]The monitor tags.
timezoneStringTimezone (DEPRECATED, use timezone in scheduleConfig instead

Returns

CreateOrUpdateCustomRule

Example

mutation CreateOrUpdateCustomRule($comparisons: [CustomRuleComparisonInput]!) {
  createOrUpdateCustomRule(comparisons: $comparisons) {
    customRule {
      id
      createdTime
      updatedTime
      uuid
      accountUuid
      projects
      datasets
      isDeleted
      deletedAt
      description
      notes
      labels
      failureAudiences
      isTemplateManaged
      namespace
      priority
      isPaused
      pausedReason
      isDraft
      isAutoCreated
    }
  }
}

Types used only by createOrUpdateCustomRule

CreateOrUpdateCustomRule

Object type. DEPRECATED. Depending on the type of monitor you would like to create, use CreateOrUpdateVolumeRule, CreateOrUpdateFreshnessCustomRule, CreateOrUpdateCustomSqlRule, CreateOrUpdateComparisonRule or CreateOrUpdateQueryPerfRule instead.

FieldTypeDescription
customRuleCustomRule

Related types

AlertGroupingInput, AudienceConditionInput, CustomRule, CustomRuleComparisonInput, DateTime, ScheduleConfigInput, TagKeyValuePairInput, UUID

createOrUpdateCustomSqlRule (mutation)

createOrUpdateCustomSqlRule is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Create or update a custom SQL monitor

Arguments

ArgumentTypeDescription
alertConditionCustomSqlRuleAlertConditionInput!Alert condition.
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
audiences[String!]The monitor audiences
autoTriageBooleanPer-monitor automated-triage override. true forces triage on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
autoTuningBooleanPer-monitor auto-apply-tuning override. true forces auto-apply tuning on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
connectionIdUUIDSpecify a connection (e.g. query-engine) to use
customSamplingSqlStringCustom sampling SQL query to run on breach
dataQualityDimensionStringData quality dimension of the monitor.
descriptionString!Used as the name in the UI
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dryRunBooleanDry run the monitor creation or update and return the MaC YAML and queries. Default: false.
dwIdUUID!Warehouse UUID
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringColumn name to use as primary key for exception management.
failOnResetBooleanReturn an error if the update is a significant change that would require a monitor reset. Default: false.
failureAudiences[String!]The monitor audiences to notify on failure
isDraftBooleanMake target a draft monitor. Default: false.
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
priorityStringThe default priority for alerts involving this monitor
queryResultTypeQueryResultTypeHow the query result is used for the metric. Uses row count if unset.
scheduleConfigScheduleConfigInput!Schedule of custom rule
skipResetBooleanDo not reset monitor if the update is a significant change that would normally cause the monitor to be reset. Learned model might not match the new monitor configuration and false positives might be detected for up to 35 days Default: false.
sqlString!Custom SQL query to run
tags[TagKeyValuePairInput!]The monitor tags.
timeoutIntTimeout for the SQL query
uuidUUIDUUID of the rule, to update an existing rule
variableDefinitions[VariableDefinitionInput!]Possible variable values for SQL query. Allows specifying runtime variables as well.
variablesJSONStringPossible variable values for SQL query

Returns

CreateOrUpdateCustomSqlRule

Example

mutation CreateOrUpdateCustomSqlRule($alertCondition: CustomSqlRuleAlertConditionInput!, $description: String!, $dwId: UUID!, $scheduleConfig: ScheduleConfigInput!, $sql: String!) {
  createOrUpdateCustomSqlRule(alertCondition: $alertCondition, description: $description, dwId: $dwId, scheduleConfig: $scheduleConfig, sql: $sql) {
    yaml
    queries
    persistBlockedBy
    spendGuardrailMessage
  }
}

Types used only by createOrUpdateCustomSqlRule

CreateOrUpdateCustomSqlRule

Object type. Create or update a custom SQL rule

FieldTypeDescription
customRuleCustomRule
yamlString
queries[String!]SQL queries that will be run by the monitor on each execution.
estimatedCreditsEstimatedCreditsSpec-derived daily credit estimate. Computed from the provided input config, not from persisted DB state — so dry-run, draft, and full create/update all return a consistent preview. Only populated for accounts on the per-monitor credit consumption pricing model; null otherwise.
persistBlockedByStringSet on dry runs only. Says why saving this monitor would not give the result the preview shows. A permission path, such as monitors/management/metric/edit, means the caller lacks it and the save would be refused. The caller can still save the monitor as a draft if it has the monitor type's draft permission. SPEND_GUARDRAIL means a spend guardrail is reached, so the save would create this new monitor as a draft instead of live. spendGuardrailMessage names the guardrail. When both apply, the permission path is returned. Null when the save would go through as previewed, and on requests that are not dry runs.
spendGuardrailMessageStringSet when a reached spend guardrail makes the save create this new monitor as a draft instead of live: on a dry run, when the save would do so, and on the save itself, when it did. A sentence for the user that names the guardrail (the account's or a domain's), its amount and when it resets, and says that an Account Owner can raise it. On a dry run whose persistBlockedBy is a permission path, the save is refused instead, so read that first. Null otherwise, including for a monitor saved as a draft on request, and for updates to an existing monitor.
CustomSqlRuleAlertConditionInput

Input object type.

FieldTypeDescription
typeComparisonType!Default: "THRESHOLD".
operatorCustomRuleComparisonOperator!Comparison operator
thresholdFloatThreshold value
isPercentageThresholdBooleanEvaluate the threshold as a percentage of a baseline query result.
percentageBaselineSqlStringSQL query counting the population the monitor evaluates. Accepted on any threshold type; required for a percentage threshold. Send an empty string to clear a stored baseline.
baselineAggFunctionAggregationFunctionFunction used to aggregate historical data points to calculate baseline
baselineIntervalMinutesIntTime interval to aggregate over to calculate baseline.
isThresholdRelativeBooleanTrue, if threshold is a relative percentage change of baseline. False, if threshold is absolute change
thresholdSensitivitySensitivityLevelsSensitivity for automated thresholds
upperThresholdFloatUpper threshold value
lowerThresholdFloatLower threshold value

Related types

AggregationFunction, AlertGroupingInput, AudienceConditionInput, ComparisonType, CustomRule, CustomRuleComparisonOperator, EstimatedCredits, JSONString, QueryResultType, ScheduleConfigInput, SensitivityLevels, TagKeyValuePairInput, UUID, VariableDefinitionInput

createOrUpdateCustomSqlTemplate (mutation)

createOrUpdateCustomSqlTemplate is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Create or update custom sql template

Arguments

ArgumentTypeDescription
descriptionStringDescription of custom sql template
dialectStringDialect of custom sql template
nameStringName of custom sql template
queryResultTypeQueryResultTypeCustomSQLTemplate's query result type can be set to SINGLE_NUMERIC, ROW_COUNT and LABELED_NUMERICS. The result is ROW_COUNT if unset
sqlTemplateString!SQL template of custom sql template
uuidUUIDUUID of custom sql template

Returns

CreateOrUpdateCustomSQLTemplate

Example

mutation CreateOrUpdateCustomSqlTemplate($sqlTemplate: String!) {
  createOrUpdateCustomSqlTemplate(sqlTemplate: $sqlTemplate) {
    customSqlTemplate {
      uuid
      name
      dialect
      description
      sqlTemplate
      queryResultType
      id
    }
  }
}

Types used only by createOrUpdateCustomSqlTemplate

CreateOrUpdateCustomSQLTemplate

Object type.

FieldTypeDescription
customSqlTemplateCustomSQLTemplate

Related types

CustomSQLTemplate, QueryResultType, UUID

Source: The GraphQL API reference

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