Make query by command to grafana.db

Hello, I would like to get a value from grafana, the same value I can get in a dashboard selecting one specific metric BUT I would like to do it by command, is it possible? Is there any way to do attack the grafana.db by command with select value from table …?
Thanks and regards