Gathering Lines of Code in an instance

SQ = 9.4
Postgres = 10.21

I am using below query to get details but it gives error

Global LOCs

> select, pm.value as value from projects p \
> 			inner join snapshots s on s.component_uuid = p.uuid \
> 			inner join project_measures pm on pm.analysis_uuid = s.uuid \
> 			inner join metrics m on where s.islast = true and p.enabled = true \
> 			and p.qualifier = 'TRK' and p.scope = 'PRJ' and p.copy_component_uuid is null \
> 			and pm.component_uuid = p.uuid and pm.person_id is null and'${metric_id}' and ( \
> 			POSITION(':' IN p.kee) = 0 or not exists( \
> 			select * from projects p_root where p_root.kee = SUBSTRING(p.kee, 0, LENGTH(p.kee) - POSITION(':' in REVERSE(p.kee)) + 1) \
> 			))"

I tried to replace table projects to components but still I am getting below error
error: pq: 42703: column does not exist

does anyone knows what is the correct query for above mentioned version , please guide
I referred old link and tried several combination but no luck


Hey there.

This is a very old query, designed long before Lines of Code was readily available in the UI. This query was used as we migrated users from our old (old) pricing model. You should not directly query the SonarQube database.

You can find this information now in the Administration > System Info

Thank you Collin,

actually I was looking for API or query to get task & analysis metrics from SQ , so thought use this query since it was working in older version for us, we want to sure that we can pull same metrics in higher version of SQ , so that we can plan to upgrade.