OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Metrics CSV Import/Export & DAX Measure Linking

Open jnrimjhim opened this issue 7 months ago • 6 comments

Is your feature request related to a problem? Please describe. The ability to bulk import/export metrics via CSV and link metrics directly to DAX measures for automatic updates.

Describe the solution you'd like Requested Capabilities:

CSV import/export for Metrics - Bulk upload metrics rather than manual creation one-by-one DAX as a measurement type - Native support for DAX (currently can be added as custom measurement type, but native support preferred) Link Metrics to DAX measures - Automatic sync so when a DAX measure changes, the metric definition updates accordingly

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

jnrimjhim avatar Apr 17 '26 10:04 jnrimjhim

hey @nikhilchennam @karanh37 @jnrimjhim i would love to work on it could you please assign it to me ? thanks

RajdeepKushwaha5 avatar Apr 20 '26 09:04 RajdeepKushwaha5

Hi @jnrimjhim @karanh37 @nikhilchennam I'd love to work on this issue as a part of Open meta data hackathon. Please assign this to me so that i start with my first contribution. Thank you

anandv29 avatar Apr 20 '26 10:04 anandv29

Assigned it to you @RajdeepKushwaha5 , looking forward for your PR.

nikhilchennam avatar Apr 20 '26 10:04 nikhilchennam

Assigned it to you @RajdeepKushwaha5 , looking forward for your PR.

I've opened a pull request to address this issue. Would you mind reviewing it when you have a moment? If everything looks good, could you please add the "safe to test" label? Thank you!

RajdeepKushwaha5 avatar Apr 20 '26 15:04 RajdeepKushwaha5

Hi @jnrimjhim @karanh37 @nikhilchennam , I'd like to work on this issue. I've studied the codebase thoroughly and have a clear implementation plan across all three requested capabilities. What I've found in the current codebase:

Metric entity schema (openmetadata-spec/.../entity/data/metric.json) already has metricExpression with a language enum — but DAX is missing. Currently only SQL | Java | JavaScript | Python | External are supported. MetricRepository.java and MetricResource.java exist but neither implements exportToCsv() / importFromCsv() — the Metric entity has no CSV support at all today, despite the framework (EntityCsv, EntityResource.exportCsvInternal/importCsvInternal) being fully in place for other entities. The Power BI connector (ingestion/source/dashboard/powerbi/) already parses DAX expressions from .pbit files — but there's no daxMeasureRef field on the Metric entity to link to them.

What I plan to implement:

  1. DAX as native expression language:

Add "DAX" to the metricExpressionLanguage enum in metric.json — triggers auto-gen of Java/TypeScript types Update the frontend expression language dropdown in the Metric form component

  1. daxMeasureRef linkage field:

Add optional daxMeasureRef: EntityReference to metric.json and createMetric.json Override setFields() / clearFields() in MetricRepository.java to handle the new reference field (following the pattern from ChartRepository) Add daxMeasureRef as an entity selector in the Metric creation/edit form (frontend)

  1. CSV import/export:

Create MetricCsv.java (extends EntityCsv) in openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ with headers: name*, displayName, description, metricType, expressionLanguage, expressionCode, unitOfMeasurement, granularity, relatedMetrics, tags, owners, domains, daxMeasureRef Override exportToCsv() and importFromCsv() in MetricRepository.java Add GET /api/v1/metrics/name/{fqn}/export, PUT /api/v1/metrics/name/{fqn}/import, and GET /api/v1/metrics/documentation/csv endpoints to MetricResource.java Add Import/Export buttons to the Metrics list page in the UI (following GlossaryV1.tsx pattern)

Note on DAX sync: The "automatic sync" behavior will work through re-running the Power BI ingestion pipeline — the daxMeasureRef field establishes the link so that when Power BI ingestion re-runs, the metric's expression can be refreshed. True real-time push sync would require a separate webhook/event mechanism and is out of scope here; I'll document this clearly. Files touched:

openmetadata-spec/.../entity/data/metric.json openmetadata-spec/.../api/data/createMetric.json openmetadata-service/.../jdbi3/MetricRepository.java openmetadata-service/.../jdbi3/MetricCsv.java (new) openmetadata-service/.../resources/metrics/MetricResource.java openmetadata-ui/.../components/Metric/ (form + list page) openmetadata-ui/.../constants/Metrics.constant.ts

Happy to start immediately. Can you assign this to me?

SahilAhuja007 avatar Apr 20 '26 21:04 SahilAhuja007

Import Export is supported in 2.0 release. DAX part is going to be covered in this ticket https://github.com/open-metadata/openmetadata-collate/issues/5988

karanh37 avatar Sep 08 '26 07:09 karanh37