-
Notifications
You must be signed in to change notification settings - Fork 0
/
freshness_monitoring.py
43 lines (27 loc) · 1.23 KB
/
freshness_monitoring.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Databricks notebook source
dbutils.widgets.text("whl", "https://ml-team-public-read.s3.us-west-2.amazonaws.com/wheels/data-monitoring/a4050ef7-b183-47a1-a145-e614628e3146/databricks_anomaly_detection-0.0.1-py3-none-any.whl")
WHL_URL = dbutils.widgets.get("whl")
# COMMAND ----------
get_ipython().run_line_magic("pip", f"install \"{WHL_URL}\"")
# COMMAND ----------
# restart python so library can be installed
dbutils.library.restartPython()
# COMMAND ----------
dbutils.widgets.text("logging_table_name", "my_logging_table")
dbutils.widgets.text("catalog_name", "my_catalog")
dbutils.widgets.text("schema_name", "my_schema")
LOGGING_TABLE_NAME = dbutils.widgets.get("logging_table_name")
CATALOG_NAME = dbutils.widgets.get("catalog_name")
SCHEMA_NAME = dbutils.widgets.get("schema_name")
# COMMAND ----------
from databricks.data_monitoring.anomalydetection import FreshnessChecker
# Instantiate the freshness checker (add additional parameters to instantiation if customization above was performed)
freshness_checker = FreshnessChecker(
catalog_name=CATALOG_NAME,
schema_name=SCHEMA_NAME,
logging_table_name=LOGGING_TABLE_NAME
)
# COMMAND ----------
# Run the checker
freshness_checker.run_freshness_checks()
# COMMAND ----------