# Update

Launch stage: Public Preview

`PATCH /api/data-quality/v1/monitors/{object_type}/{object_id}`

Update a data quality monitor on Unity Catalog object.

 For the `table` `object_type`, the caller must have either of the following sets of permissions:
 1. **MANAGE** and **USE_CATALOG** on the table's parent catalog.
 2. **USE_CATALOG** on the table's parent catalog, and **MANAGE** and **USE_SCHEMA** on the table's parent schema.
 3. **USE_CATALOG** on the table's parent catalog, **USE_SCHEMA** on the table's parent schema, and **MANAGE** on the table.

 For the `schema` `object_type`, the caller must have either of the following sets of permissions:
 1. **MANAGE** and **USE_CATALOG** on the schema's parent catalog.
 2. **USE_CATALOG** on the schema's parent catalog, and **MANAGE** and **USE_SCHEMA** on the schema.

API scopes: dataquality

## Path parameters

- `object_type` (string, optional)
  The type of the monitored object. Can be one of the following: `schema` or `table`.
- `object_id` (string, optional)
  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.

## Query parameters

- `update_mask` (string, optional)
  The field mask to specify which fields to update as a comma-separated list.
   Example value: `data_profiling_config.custom_metrics,data_profiling_config.schedule.quartz_cron_expression`

## Request body

- `monitor` (object, optional)
  The monitor to update.
  - `object_type` (string, optional)
    The type of the monitored object. Can be one of the following: `schema` or `table`.
    Example: `schema`
  - `object_id` (string, optional)
    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, optional)
    Anomaly Detection Configuration, applicable to `schema` object types.
    - `excluded_table_full_names` (array of string, optional, Beta)
      List of fully qualified table names to exclude from anomaly detection.
  - `data_profiling_config` (object, optional)
    Data Profiling Configuration, applicable to `table` object types. Exactly one `Analysis Configuration`
     must be present.
    - `output_schema_id` (string, optional)
      ID of the schema where output tables are created.
    - `assets_dir` (string, optional)
      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, required)
      `Analysis Configuration` for monitoring inference log tables.
      - `problem_type` (string, optional)
        Problem type the model aims to solve.
        Possible values: `INFERENCE_PROBLEM_TYPE_UNSPECIFIED`, `INFERENCE_PROBLEM_TYPE_CLASSIFICATION`, `INFERENCE_PROBLEM_TYPE_REGRESSION`
      - `timestamp_column` (string, optional)
        Column for the timestamp.
      - `granularities` (array of string, optional)
        List of granularities to use when aggregating data into time windows based on their timestamp.
        Possible values: `AGGREGATION_GRANULARITY_UNSPECIFIED`, `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, optional)
        Column for the prediction.
      - `label_column` (string, optional)
        Column for the label.
      - `model_id_column` (string, optional)
        Column for the model identifier.
    - `time_series` (object, required)
      `Analysis Configuration` for monitoring time series tables.
      - `timestamp_column` (string, optional)
        Column for the timestamp.
      - `granularities` (array of string, optional)
        List of granularities to use when aggregating data into time windows based on their timestamp.
        Possible values: `AGGREGATION_GRANULARITY_UNSPECIFIED`, `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, required)
      `Analysis Configuration` for monitoring snapshot tables.
    - `slicing_exprs` (array of string, optional)
      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, optional)
      Custom metrics.
      - `name` (string, optional)
        Name of the metric in the output tables.
      - `definition` (string, optional)
        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, optional)
        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, optional)
        The output type of the custom metric.
      - `type` (string, optional)
        The type of the custom metric.
        Possible values: `DATA_PROFILING_CUSTOM_METRIC_TYPE_UNSPECIFIED`, `DATA_PROFILING_CUSTOM_METRIC_TYPE_AGGREGATE`, `DATA_PROFILING_CUSTOM_METRIC_TYPE_DERIVED`, `DATA_PROFILING_CUSTOM_METRIC_TYPE_DRIFT`
    - `baseline_table_name` (string, optional)
      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, optional)
      The cron schedule.
      - `quartz_cron_expression` (string, optional)
        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, optional)
        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, optional)
        Read only field that indicates whether the schedule is paused or not.
        Possible values: `CRON_SCHEDULE_PAUSE_STATUS_UNSPECIFIED`, `CRON_SCHEDULE_PAUSE_STATUS_UNPAUSED`, `CRON_SCHEDULE_PAUSE_STATUS_PAUSED`
    - `notification_settings` (object, optional)
      Field for specifying notification settings.
      - `on_failure` (object, optional)
        Destinations to send notifications on failure/timeout.
    - `skip_builtin_dashboard` (boolean, optional)
      Whether to skip creating a default dashboard summarizing data quality metrics.
    - `warehouse_id` (string, optional)
      Optional argument to specify the warehouse for dashboard creation. If not specified, the first running
       warehouse will be used.
    - `monitored_table_name` (string, optional)
      Unity Catalog table to monitor. Format: `catalog.schema.table_name`
    - `status` (string, optional)
      The data profiling monitor status.
      Possible values: `DATA_PROFILING_STATUS_UNSPECIFIED`, `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, optional)
      The latest error message for a monitor failure.
    - `profile_metrics_table_name` (string, optional)
      Table that stores profile metrics data. Format: `catalog.schema.table_name`.
    - `drift_metrics_table_name` (string, optional)
      Table that stores drift metrics data. Format: `catalog.schema.table_name`.
    - `dashboard_id` (string, optional)
      Id of dashboard that visualizes the computed metrics.
       This can be empty if the monitor is in PENDING state.
    - `monitor_version` (int64, optional)
      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, optional)
      The warehouse for dashboard creation

## Returns

Returns the Monitor object.

## Response

```json
{
  "object_type": "schema",
  "object_id": "string",
  "anomaly_detection_config": {
    "excluded_table_full_names": [
      "string"
    ]
  },
  "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": "string",
    "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"
  }
}
```

