Area: API
Sub-Area: GraphQL API
Applies to: Cloud
Issue
You call the GraphQL API to create a schema assertion and the request fails. The request may use the wrong mutation, the wrong input shape, or leave out a required field.
You Might Be Asking
- Which mutation creates a schema assertion?
- Which input fields are required?
- Which fields are optional?
- Is there a version I need to upgrade to?
Cause
DataHub Cloud creates or updates schema assertions with the upsertDatasetSchemaAssertionMonitor mutation. Its input type is UpsertDatasetSchemaAssertionMonitorInput, and several fields are required. upsertDatasetFieldAssertionMonitor is the mutation for field assertions, not schema assertions.
evaluationSchedule is required. It takes both cron and timezone, and both are non-null strings. Do not leave it out.
This article does not name a DataHub version that fixes this. Check your request against the required fields below.
Solution
Call the mutation at https://<your-account>.acryl.io/api/graphql. Send a personal access token as a Bearer token.
The signature is:
upsertDatasetSchemaAssertionMonitor(assertionUrn: String, input: UpsertDatasetSchemaAssertionMonitorInput!)
Pass assertionUrn only when you update an existing assertion.
Required input fields
-
entityUrn: the dataset URN. -
assertion: an object withcompatibilityandfields.-
compatibilityis one ofEXACT_MATCH,SUPERSETorSUBSET. -
fieldsis a list. Each item haspathandtype.nativeTypeis optional.
-
mode-
evaluationSchedule: an object withcron(String!) andtimezone(String!).
Optional input fields
descriptionactionsexecutorIdevaluationParameters
Schema assertions are evaluated whenever DataHub detects a schema change in the ingested schema. They work on any platform whose schema DataHub ingests.
The example in the Schema Assertions doc leaves out evaluationSchedule. Add it to your request.
If a Cloud-only server setting blocks assertion creation, contact DataHub Support.