pull actual execution of SQL into has_metrics to simplify declaration. aggregate function is now just a SQL string.