Is there a way to export the effective MAQL that's...
# gooddata-cloud
Is there a way to export the effective MAQL that's backing a full insight/view so we can take it and modify it slightly? Reconstructing what an insight is doing that doesn't start as MAQL is more difficult without this.
Hi Philip, This is probably not exactly what you were hoping for, but you can use our API to retrieve the details of your Insights and its Metrics, if needed. Please check the calls below.
That is not what we need in this case. We want to be able to reconstruct the MAQL so we can tweak something on it. I don't see any ability to view the MAQL behind the metric/view/etc. here... unless I'm missing it?
Hi Philip, insights are built via AFM execution, therefore there is no MAQL syntax in their definition. More information about it here > Retrieve Data Through API | GoodData Cloud Native. Could you let us know what your insight looks like or give an example? I’m not sure what you mean by the insight “doesn’t start as MAQL”
I had the maybe incorrect assumption that, under the covers, everything that ends up querying a datasource is represented as MAQL. Let's say we want to build a metric that is just a little bit different from one that can be built using the GUI -- ideally rather than writing MAQL from scratch, we configure via the GUI something close to what we want, then tweak the underlying MAQL slightly to add the differences we need.
I think I understand what you are looking for. We are considering a feature on our roadmap which would work in a way that metrics created in Analyze e.g. by drag and drop would be usable as starting point for creation of some advanced metrics using MAQL. Currently this is not possible and you need to type MAQL from scratch or reuse MAQL for metrics defined by MAQL. The metrics created in UI are usually quite simple. E.g • “Sum of fact value” translates to
select sum({fact/value})
• Metric revenue with applied local filter on region attribute translates to
select {metric/revenue} where {label/region} in ("West")
• Simple arithmetic metrics like A+B translate to formula
select ifnull({metric/a},0)+ifnull({metric/b},0)
• Show as percent metrics should work like
select {metric/a} / (select {metric/a} by all other)
• Numeric range filters and ranking filters are applied as HAVING filters. • The metrics which compare data to the same period a year ago use
FOR PREVIOUS({attribute/date.year})
👍 2
🎉 New note created.
@Josh Kladis see above for starting points perhaps? ☝️ Thanks @Jakub Sterba
👀 1