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

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group