Solved

Get SQL behind metrics

  • 31 March 2022
  • 3 replies
  • 161 views

Hi all,

 

Is there a way to see what the SQL querying the DB is behind a particular metric?

 

Thanks

icon

Best answer by Jan Kos 1 April 2022, 18:59

View original

3 replies

Userlevel 2

Hello Filip,

To get a SQL query behind metric you would need to create insight with a metric first. You can just only add a metric in to for example table insight and save it. Then you navigate to following resource in grey pages:

https://yourdomain.com/gdc/md/<projectID>/query/visualizationobjects

and find your saved insight. From there navigate to:

  },
"links" : {
"explain" : "/gdc/md/bj40ijh91yr6rgsb4dlvskla66r0a1t0/obj/128744/explain"

You'll get explain resource for the insight, where you select “SQL Database Selects” and hit submit. 

 

 

-Jan

Hi Michael,

Thanks for the reply, but this actually doesn't show the SQL behind the metric, it just returns a diagram of how the metric is computed.

Is it possible to see the SQL behind the metrics somewhere?

 

Thanks

Userlevel 2

Hi Filip, 

please see the following resource in GreyPages which should help in this case:
https://<Your Domain>/gdc/md/<Project ID>/query/metrics

From there you can open any metric and go the "explain2" resource:

"links" : {
"explain2" : "/gdc/md/<Project ID>/obj/422/explain2"
},

From there you will see the GoodData Algebraic Query Engine Explain Resource. 

Reply