from metadata.sdk import configurefrom metadata.sdk.entities import Metricsconfigure( host="https://your-org.getcollate.io/api", jwt_token="your-jwt-token")# The SDK calculates and submits JSON Patch from the changed entity.metric = Metrics.retrieve("b8a9d6e4-2f7c-4f3a-9c1e-6d5b8a7f2e10")metric.description = "Percentage of active customers retained month over month."metric.displayName = "Monthly Customer Retention Rate"updated = Metrics.update(metric)print(f"Updated to version {updated.version.root}")
// client is an initialized OpenMetadataClient.var metricId = "b8a9d6e4-2f7c-4f3a-9c1e-6d5b8a7f2e10";var metric = client.metrics().get(metricId);metric.setDescription( "Percentage of active customers retained month over month.");metric.setDisplayName("Monthly Customer Retention Rate");// update() calculates and submits JSON Patch from the fetched snapshot.var updated = client.metrics().update(metricId, metric);System.out.println("Updated to version " + updated.getVersion());
from metadata.sdk import configurefrom metadata.sdk.entities import Metricsconfigure( host="https://your-org.getcollate.io/api", jwt_token="your-jwt-token")# The SDK calculates and submits JSON Patch from the changed entity.metric = Metrics.retrieve("b8a9d6e4-2f7c-4f3a-9c1e-6d5b8a7f2e10")metric.description = "Percentage of active customers retained month over month."metric.displayName = "Monthly Customer Retention Rate"updated = Metrics.update(metric)print(f"Updated to version {updated.version.root}")
// client is an initialized OpenMetadataClient.var metricId = "b8a9d6e4-2f7c-4f3a-9c1e-6d5b8a7f2e10";var metric = client.metrics().get(metricId);metric.setDescription( "Percentage of active customers retained month over month.");metric.setDisplayName("Monthly Customer Retention Rate");// update() calculates and submits JSON Patch from the fetched snapshot.var updated = client.metrics().update(metricId, metric);System.out.println("Updated to version " + updated.getVersion());
Create a metric or update it if it already exists, using PUT /v1/metrics with the full request body. Send the complete definition, not just the fields you want to change. To change only some fields, use PATCH with a JSON Patch array and the application/json-patch+json content type, as shown in the PATCH examples below.
Body Parameters
string
required
Globally unique name of the metric.
string
Human-readable display name for the metric.
string
Description of what the metric measures and how it should be used, in Markdown format.
object
Expression used to calculate the metric.
Show properties
string
Expression language: SQL, Java, JavaScript, Python, or External.
string
Code or external expression that calculates the metric.
from metadata.sdk import configurefrom metadata.sdk.entities import Metricsconfigure( host="https://your-org.getcollate.io/api", jwt_token="your-jwt-token")# The SDK calculates and submits JSON Patch from the changed entity.metric = Metrics.retrieve("b8a9d6e4-2f7c-4f3a-9c1e-6d5b8a7f2e10")metric.description = "Percentage of active customers retained month over month."metric.displayName = "Monthly Customer Retention Rate"updated = Metrics.update(metric)print(f"Updated to version {updated.version.root}")
// client is an initialized OpenMetadataClient.var metricId = "b8a9d6e4-2f7c-4f3a-9c1e-6d5b8a7f2e10";var metric = client.metrics().get(metricId);metric.setDescription( "Percentage of active customers retained month over month.");metric.setDisplayName("Monthly Customer Retention Rate");// update() calculates and submits JSON Patch from the fetched snapshot.var updated = client.metrics().update(metricId, metric);System.out.println("Updated to version " + updated.getVersion());