def antenna_metrics_agg_query(columns, table_name='%(table_name)s'):
    """
    Aggregated dataframe of antenna metrics over all chunks by given column
    names.

    Inputs
    ------
    table_name : name of the table the query is supposed to run on,
                 defaulting to '%(table_name)s', i.e. no substitution
    columns : names of columns to aggregate by, e.g. 'hour' or
              'week_part, week_number'

    Output
    ------
    Aggregated dataframe of antenna metrics over all chunks by given column
    names.
    """
    query = """
        SELECT
          antenna_id,
          %(columns)s,
          SUM(og_sms) as og_sms,
          SUM(ic_sms) as ic_sms,
          SUM(og_calls) as og_calls,
          SUM(ic_calls) as ic_calls,
          SUM(og_vol) as og_vol,
          SUM(ic_vol) as ic_vol
        FROM %(table_name)s
        GROUP BY antenna_id, %(columns)s
    """
    return query % {'table_name': table_name, 'columns': columns}
