def get_cumulative_spend(key):
    """
    Get the sum of spending for this category up to and including the given
    month.
    """
    query = ('ROUND(SUM(total_ex_vat), 2) AS total '
             'FROM {table} '
             'WHERE date <= "{year}-{month:02}-01" '
             'AND lot="{lot}" '
             'AND customer_sector="{sector}" '
             'AND supplier_type="{sme_large}"'.format(
                 table=_RAW_SALES_TABLE,
                 year=key.year,
                 month=key.month,
                 lot=key.lot,
                 sector=key.sector,
                 sme_large=key.sme_large))
    logging.debug(query)
    result = scraperwiki.sqlite.select(query)
    logging.debug(result)
    value = result[0]['total']
    return float(result[0]['total']) if value is not None else 0.0
def get_cumulative_spend ( key ) : query = ( 'ROUND(SUM(total_ex_vat), 2) AS total ' 'FROM {table} ' 'WHERE date <= "{year}-{month:02}-01" ' 'AND lot="{lot}" ' 'AND customer_sector="{sector}" ' 'AND supplier_type="{sme_large}"' . format ( table = _RAW_SALES_TABLE , year = key . year , month = key . month , lot = key . lot , sector = key . sector , sme_large = key . sme_large ) ) logging . debug ( query ) result = scraperwiki . sqlite . select ( query ) logging . debug ( result ) value = result [ 0 ] [ 'total' ] return float ( result [ 0 ] [ 'total' ] ) if value is not None else 0.0
Get the sum of spending for this category up to and including the given
    month.