cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
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

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now