SQL query for a Projects coverage metrics

mysql

(Allegra Cooper) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

SonarQube v. 6.7.5
I’m trying to get the SQL query for the coverage metrics for a project. So far I have the data from the following tables Projects, Project_Measures, and Metrics.

But I’m not getting the same data from the query that I see for a project in sonarqube.


(Colin Mueller) #2

We don’t recommend querying the database directly, and don’t provide any advice on queries. Why not use the Web API (documentation linked in the footer of your instance)? Happy to answer any questions about pulling info using that means.


(Allegra Cooper) #3

We are using grafana to aggregate and display data using queries. Do you provide the schema mapping for this version of sonar, just in case I still need to go into this direction because unfortunately, Grafana doesn’t support API calls.


(Colin Mueller) #4

We don’t publicly document the schema. It should be treated as a blackbox.

That said, our Web API is very well documented and follows consistent deprecation strategies when we make changes.

A quick google search showed me the following: https://community.grafana.com/t/how-to-import-rest-api-data/5772/2 / https://grafana.com/plugins/grafana-simple-json-datasource