Data Quality Monitors¶
Package: databricks.bundles.data_quality_monitors
Classes¶
- class AggregationGranularity¶
The granularity for aggregating data into time windows based on their timestamp.
- AGGREGATION_GRANULARITY_5_MINUTES = 'AGGREGATION_GRANULARITY_5_MINUTES'¶
- AGGREGATION_GRANULARITY_30_MINUTES = 'AGGREGATION_GRANULARITY_30_MINUTES'¶
- AGGREGATION_GRANULARITY_1_HOUR = 'AGGREGATION_GRANULARITY_1_HOUR'¶
- AGGREGATION_GRANULARITY_1_DAY = 'AGGREGATION_GRANULARITY_1_DAY'¶
- AGGREGATION_GRANULARITY_1_WEEK = 'AGGREGATION_GRANULARITY_1_WEEK'¶
- AGGREGATION_GRANULARITY_2_WEEKS = 'AGGREGATION_GRANULARITY_2_WEEKS'¶
- AGGREGATION_GRANULARITY_3_WEEKS = 'AGGREGATION_GRANULARITY_3_WEEKS'¶
- AGGREGATION_GRANULARITY_4_WEEKS = 'AGGREGATION_GRANULARITY_4_WEEKS'¶
- AGGREGATION_GRANULARITY_1_MONTH = 'AGGREGATION_GRANULARITY_1_MONTH'¶
- AGGREGATION_GRANULARITY_1_YEAR = 'AGGREGATION_GRANULARITY_1_YEAR'¶
- class AnomalyDetectionConfig¶
Anomaly Detection Configurations.
- notification_settings: NotificationSettings | None = None¶
Who to alert when anomaly detection finds unhealthy tables in this schema. Applicable to schema monitors only. This is the same schema alert you manage from Manage alerts in the Data Quality Monitoring UI, so a change made in either place shows in both.
Set the recipients in on_unhealthy_table; on_failure is not supported here. Only destination_ids and destination_user_ids are supported.
On update, an update mask of *, anomaly_detection_config, or anomaly_detection_config.notification_settings replaces the alert’s recipients with the ones in the request; omitting the field, or leaving both recipient lists empty, removes the alert. Other masks leave the alert unchanged.
- class CronSchedule¶
The data quality monitoring workflow cron schedule.
- timezone_id: str¶
The Java timezone ID in which the cron expression is evaluated. See Java TimeZone for the supported IDs.
- class DataProfilingConfig¶
Data Profiling Configurations.
- output_schema_id: str¶
The UUID of the Unity Catalog schema where the profile and drift metrics tables are created.
- assets_dir: str | None = None¶
The absolute workspace path of the directory where the monitor’s assets, such as the dashboard, are stored. The UI and the Python APIs normally prepopulate a default user location.
- baseline_table_name: str | None = None¶
The fully qualified name of a baseline table. Format: catalog.schema.table_name. Drift metrics compare the monitored table against the baseline data, so the two tables must have the same schema.
- custom_metrics: list[DataProfilingCustomMetric]¶
Custom metrics to compute in addition to the built-in ones. See custom metrics.
- inference_log: InferenceLogConfig | None = None¶
Profiles an inference log table, which stores the requests and predictions of a model. Metrics are computed per time window and include model quality metrics.
- notification_settings: NotificationSettings | None = None¶
Who to notify about this monitor’s refreshes. Only on_failure with email_addresses is supported here.
- schedule: CronSchedule | None = None¶
The schedule on which the monitor refreshes its metrics. Refreshes can also be triggered on demand through the Refresh resource.
- skip_builtin_dashboard: bool | None = None¶
Whether to skip creating a default dashboard summarizing data quality metrics.
- slicing_exprs: list[str]¶
List of column expressions to slice data with for targeted analysis. The data is grouped by each expression independently, resulting in a separate slice for each predicate and its complements. For example slicing_exprs=[“col_1”, “col_2 > 10”] will generate the following slices: two slices for col_2 > 10 (True and False), and one slice per unique value in col_1. For high-cardinality columns, only the top 100 unique values by frequency will generate slices.
- snapshot: SnapshotConfig | None = None¶
Profiles the full contents of the table. Metrics are computed over all rows at each refresh.
- time_series: TimeSeriesConfig | None = None¶
Profiles a time series table. Metrics are computed per time window, as defined by timestamp_column and granularities.
- class DataProfilingCustomMetric¶
Custom metric definition.
- definition: str¶
Jinja template for a SQL expression that specifies how to compute the metric. See create metric definition.
- output_data_type: str¶
Specifies the Spark SQL data type of the metric value, either as a plain type name or as a JSON-encoded StructField.
- type: DataProfilingCustomMetricType¶
The type of the custom metric. DATA_PROFILING_CUSTOM_METRIC_TYPE_AGGREGATE metrics depend only on the columns of the input table, DATA_PROFILING_CUSTOM_METRIC_TYPE_DERIVED metrics depend only on previously computed aggregate metrics, and DATA_PROFILING_CUSTOM_METRIC_TYPE_DRIFT metrics depend on previously computed aggregate or derived metrics.
- class DataProfilingCustomMetricType¶
The custom metric type.
- DATA_PROFILING_CUSTOM_METRIC_TYPE_AGGREGATE = 'DATA_PROFILING_CUSTOM_METRIC_TYPE_AGGREGATE'¶
- DATA_PROFILING_CUSTOM_METRIC_TYPE_DERIVED = 'DATA_PROFILING_CUSTOM_METRIC_TYPE_DERIVED'¶
- DATA_PROFILING_CUSTOM_METRIC_TYPE_DRIFT = 'DATA_PROFILING_CUSTOM_METRIC_TYPE_DRIFT'¶
- class DataQualityMonitor¶
A data quality monitor on a Unity Catalog object. A schema monitor runs anomaly detection on the tables in the schema and is configured through anomaly_detection_config. A table monitor profiles a single table and is configured through data_profiling_config.
- object_id: str¶
The UUID of the request object. It is schema_id for schema, and table_id for table.
Find the schema_id from either: 1. The schema_id of the Schemas resource. 2. In Catalog Explorer > select the schema > go to the Details tab > the Schema ID field.
Find the table_id from either: 1. The table_id of the Tables resource. 2. In Catalog Explorer > select the table > go to the Details tab > the Table ID field.
- anomaly_detection_config: AnomalyDetectionConfig | None = None¶
Anomaly detection settings. Required when object_type is schema. When reading a table monitor, this holds the settings of the parent schema’s monitor if the schema has one.
- data_profiling_config: DataProfilingConfig | None = None¶
Data profiling settings. Required when object_type is table. Exactly one of inference_log, time_series or snapshot must be set.
- class DependsOn¶
- class InferenceLogConfig¶
Inference log configuration.
- model_id_column: str¶
Column containing the ID of the model that produced each prediction. A slice is created automatically for each distinct model ID.
- problem_type: InferenceProblemType¶
The type of problem the model solves. It determines which model quality metrics are computed.
- timestamp_column: str¶
Column containing the timestamp of each inference request. Its type must be TIMESTAMP or convertible to a timestamp.
- granularities: list[AggregationGranularity]¶
List of granularities to use when aggregating data into time windows based on their timestamp.
- class InferenceProblemType¶
Inference problem type the model aims to solve.
- INFERENCE_PROBLEM_TYPE_CLASSIFICATION = 'INFERENCE_PROBLEM_TYPE_CLASSIFICATION'¶
- INFERENCE_PROBLEM_TYPE_REGRESSION = 'INFERENCE_PROBLEM_TYPE_REGRESSION'¶
- class Lifecycle¶
- depends_on: list[DependsOn]¶
Resources that must be deployed before this resource and deleted after it. Unlike variable references, this only affects ordering.
- class NotificationDestination¶
Destination of the data quality monitoring notification.
- destination_ids: list[str]¶
The notification-destination IDs (Slack / Teams / webhook / Asana / ServiceNow / AWS EventBridge) to send the notification to. The destinations must already exist in the workspace; a workspace admin creates them. A maximum of 25 destination IDs is supported. Only supported on schema monitors, via anomaly_detection_config; rejected on table monitors.
- destination_user_ids: list[int]¶
The IDs of the workspace users to notify by email. A maximum of 25 user IDs is supported. Only supported on schema monitors, via anomaly_detection_config; rejected on table monitors.
- class NotificationSettings¶
Settings for sending notifications on the data quality monitoring.
- on_failure: NotificationDestination | None = None¶
Recipients to notify when a refresh of the monitor fails or times out. Only supported on table monitors, via data_profiling_config, and only email_addresses is accepted there.
- on_unhealthy_table: NotificationDestination | None = None¶
Recipients to notify when anomaly detection finds unhealthy tables in the schema. Each recipient gets one notification per important unhealthy table. Only supported on schema monitors, via anomaly_detection_config.
- class SnapshotConfig¶
Snapshot analysis configuration.
- class TimeSeriesConfig¶
Time series analysis configuration.
- timestamp_column: str¶
Column containing the timestamp of each row. Its type must be TIMESTAMP or convertible to a timestamp.
- granularities: list[AggregationGranularity]¶
List of granularities to use when aggregating data into time windows based on their timestamp.