cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Where can I quickly test custom metric queries?

HeckGunderson
New Contributor

I'm working on adapting some custom metrics to add to the tables' dashboard. Right now when I throw in a test query, I need to refresh metrics and it takes 5-10 minutes to let me know I've probably forgotten a parenthesis somewhere.

Where can I test the python style of metric generation more quickly?

As an example from the documentation, is there a query editor I can use to make changes to this:

from databricks.sdk.service.catalog import MonitorMetric, MonitorMetricType
from pyspark.sql import types as T

MonitorMetric(
    type=MonitorMetricType.CUSTOM_METRIC_TYPE_AGGREGATE,
    name="squared_avg",
    input_columns=["f1", "f2"],
    definition="avg(`{{input_column}}`*`{{input_column}}`)",
    output_data_type=T.StructField("output", T.DoubleType()).json(),
)

 

1 REPLY 1

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @HeckGunderson,

Have you tried running the code using notebook with your Databricks workspace?

https://docs.databricks.com/en/notebooks/index.html

Also you can do it via CLI using SQL connector.

https://docs.databricks.com/ja/dev-tools/python-sql-connector.html