# The Monitor object

Monitor for the data quality of unity catalog entities such as schema or table.

## Attributes

- `object_type` (string)
  The type of the monitored object. Can be one of the following: `schema` or `table`.
  Example: `schema`
- `object_id` (string)
  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](https://docs.databricks.com/api/workspace/schemas/get#schema_id) of the `Schemas` resource.
   2. In [Catalog Explorer](https://docs.databricks.com/aws/en/catalog-explorer/) > select the `schema` > go to the `Details` tab > the `Schema ID` field.
  
   Find the `table_id` from either:
   1. The [table_id](https://docs.databricks.com/api/workspace/tables/get#table_id) of the `Tables` resource.
   2. In [Catalog Explorer](https://docs.databricks.com/aws/en/catalog-explorer/) > select the `table` > go to the `Details` tab > the `Table ID` field.
- `anomaly_detection_config` (object)
  Anomaly Detection Configuration, applicable to `schema` object types.
  - `excluded_table_full_names` (array of string, Beta)
    List of fully qualified table names to exclude from anomaly detection.
  - `notification_settings` (object)
    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.
    - `on_failure` (object)
      Destinations to send notifications on failure/timeout.
      - `email_addresses` (array of string)
        The list of email addresses to send the notification to. A maximum of 5 email addresses is supported.
      - `destination_ids` (array of string)
        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` (array of int64)
        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.
    - `on_unhealthy_table` (object)
      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`.
      - `email_addresses` (array of string)
        The list of email addresses to send the notification to. A maximum of 5 email addresses is supported.
      - `destination_ids` (array of string)
        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` (array of int64)
        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.
- `data_profiling_config` (object)
  Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
   must be present.
  - `output_schema_id` (string)
    ID of the schema where output tables are created.
  - `assets_dir` (string, Immutable)
    Field for specifying the absolute path to a custom directory to store data-monitoring
     assets. Normally prepopulated to a default user location via UI and Python APIs.
  - `inference_log` (object)
    `Analysis Configuration` for monitoring inference log tables.
    - `problem_type` (string)
      Problem type the model aims to solve.
      Possible values:
      - `INFERENCE_PROBLEM_TYPE_CLASSIFICATION`
      - `INFERENCE_PROBLEM_TYPE_REGRESSION`
    - `timestamp_column` (string)
      Column for the timestamp.
    - `granularities` (array of string)
      List of granularities to use when aggregating data into time windows based on their timestamp.
      Possible values:
      - `AGGREGATION_GRANULARITY_5_MINUTES`
      - `AGGREGATION_GRANULARITY_30_MINUTES`
      - `AGGREGATION_GRANULARITY_1_HOUR`
      - `AGGREGATION_GRANULARITY_1_DAY`
      - `AGGREGATION_GRANULARITY_1_WEEK`
      - `AGGREGATION_GRANULARITY_2_WEEKS`
      - `AGGREGATION_GRANULARITY_3_WEEKS`
      - `AGGREGATION_GRANULARITY_4_WEEKS`
      - `AGGREGATION_GRANULARITY_1_MONTH`
      - `AGGREGATION_GRANULARITY_1_YEAR`
    - `prediction_column` (string)
      Column for the prediction.
    - `label_column` (string)
      Column for the label.
    - `model_id_column` (string)
      Column for the model identifier.
  - `time_series` (object)
    `Analysis Configuration` for monitoring time series tables.
    - `timestamp_column` (string)
      Column for the timestamp.
    - `granularities` (array of string)
      List of granularities to use when aggregating data into time windows based on their timestamp.
      Possible values:
      - `AGGREGATION_GRANULARITY_5_MINUTES`
      - `AGGREGATION_GRANULARITY_30_MINUTES`
      - `AGGREGATION_GRANULARITY_1_HOUR`
      - `AGGREGATION_GRANULARITY_1_DAY`
      - `AGGREGATION_GRANULARITY_1_WEEK`
      - `AGGREGATION_GRANULARITY_2_WEEKS`
      - `AGGREGATION_GRANULARITY_3_WEEKS`
      - `AGGREGATION_GRANULARITY_4_WEEKS`
      - `AGGREGATION_GRANULARITY_1_MONTH`
      - `AGGREGATION_GRANULARITY_1_YEAR`
  - `snapshot` (object)
    `Analysis Configuration` for monitoring snapshot tables.
  - `slicing_exprs` (array of string)
    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
     `col1`. For high-cardinality columns, only the top 100 unique values by frequency will
     generate slices.
  - `custom_metrics` (array of object)
    Custom metrics.
    - `name` (string)
      Name of the metric in the output tables.
    - `definition` (string)
      Jinja template for a SQL expression that specifies how to compute the metric. See [create metric definition](https://docs.databricks.com/en/lakehouse-monitoring/custom-metrics.html#create-definition).
    - `input_columns` (array of string)
      A list of column names in the input table the metric should be computed for.
       Can use ``":table"`` to indicate that the metric needs information from multiple columns.
    - `output_data_type` (string)
      The output type of the custom metric.
    - `type` (string)
      The type of the custom metric.
      Possible values:
      - `DATA_PROFILING_CUSTOM_METRIC_TYPE_AGGREGATE`
      - `DATA_PROFILING_CUSTOM_METRIC_TYPE_DERIVED`
      - `DATA_PROFILING_CUSTOM_METRIC_TYPE_DRIFT`
  - `baseline_table_name` (string)
    Baseline table name.
     Baseline data is used to compute drift from the data in the monitored `table_name`.
     The baseline table and the monitored table shall have the same schema.
  - `schedule` (object)
    The cron schedule.
    - `quartz_cron_expression` (string)
      The expression that determines when to run the monitor. See [examples](https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html).
    - `timezone_id` (string)
      A Java timezone id. The schedule for a job will be resolved with respect to this timezone.
       See `Java TimeZone <http://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html>`_ for details.
       The timezone id (e.g., ``America/Los_Angeles``) in which to evaluate the quartz expression.
    - `pause_status` (string, Output only)
      Read only field that indicates whether the schedule is paused or not.
      Possible values:
      - `CRON_SCHEDULE_PAUSE_STATUS_UNPAUSED`
      - `CRON_SCHEDULE_PAUSE_STATUS_PAUSED`
  - `notification_settings` (object)
    Field for specifying notification settings.
    - `on_failure` (object)
      Destinations to send notifications on failure/timeout.
      - `email_addresses` (array of string)
        The list of email addresses to send the notification to. A maximum of 5 email addresses is supported.
      - `destination_ids` (array of string)
        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` (array of int64)
        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.
    - `on_unhealthy_table` (object)
      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`.
      - `email_addresses` (array of string)
        The list of email addresses to send the notification to. A maximum of 5 email addresses is supported.
      - `destination_ids` (array of string)
        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` (array of int64)
        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.
  - `skip_builtin_dashboard` (boolean, Input only)
    Whether to skip creating a default dashboard summarizing data quality metrics.
  - `warehouse_id` (string, Input only)
    Optional argument to specify the warehouse for dashboard creation. If not specified, the first running
     warehouse will be used.
  - `monitored_table_name` (string, Output only)
    Unity Catalog table to monitor. Format: `catalog.schema.table_name`
  - `status` (string, Output only)
    The data profiling monitor status.
    Possible values:
    - `DATA_PROFILING_STATUS_ACTIVE`
    - `DATA_PROFILING_STATUS_PENDING`
    - `DATA_PROFILING_STATUS_DELETE_PENDING`
    - `DATA_PROFILING_STATUS_ERROR`
    - `DATA_PROFILING_STATUS_FAILED`
  - `latest_monitor_failure_message` (string, Output only)
    The latest error message for a monitor failure.
  - `profile_metrics_table_name` (string, Output only)
    Table that stores profile metrics data. Format: `catalog.schema.table_name`.
  - `drift_metrics_table_name` (string, Output only)
    Table that stores drift metrics data. Format: `catalog.schema.table_name`.
  - `dashboard_id` (string, Output only)
    Id of dashboard that visualizes the computed metrics.
     This can be empty if the monitor is in PENDING state.
  - `monitor_version` (int64, Output only)
    Represents the current monitor configuration version in use. The version will be represented in a
     numeric fashion (1,2,3...). The field has flexibility to take on negative values, which can indicate corrupted
     monitor_version numbers.
  - `effective_warehouse_id` (string, Output only)
    The warehouse for dashboard creation

## Example

```json
{
  "object_type": "schema",
  "object_id": "string",
  "anomaly_detection_config": {
    "excluded_table_full_names": [
      "string"
    ],
    "notification_settings": {}
  },
  "data_profiling_config": {
    "output_schema_id": "string",
    "assets_dir": "string",
    "inference_log": {},
    "time_series": {},
    "snapshot": {},
    "slicing_exprs": [
      "string"
    ],
    "custom_metrics": [
      {}
    ],
    "baseline_table_name": "string",
    "schedule": {},
    "notification_settings": {},
    "skip_builtin_dashboard": true,
    "warehouse_id": "string",
    "monitored_table_name": "string",
    "status": "DATA_PROFILING_STATUS_ACTIVE",
    "latest_monitor_failure_message": "string",
    "profile_metrics_table_name": "string",
    "drift_metrics_table_name": "string",
    "dashboard_id": "string",
    "monitor_version": 0,
    "effective_warehouse_id": "string"
  }
}
```


