@allow_cross_site_request
@non_atomic_requests
def render_csv(request, addon, stats, fields,
               title=None, show_disclaimer=None):
    # Start with a header from the template.
    ts = time.strftime('%c %z')
    context = {'addon': addon, 'timestamp': ts, 'title': title,
               'show_disclaimer': show_disclaimer}
    response = render(request, 'stats/csv_header.txt', context)

    writer = UnicodeCSVDictWriter(response, fields, restval=0,
                                  extrasaction='ignore')
    writer.writeheader()
    writer.writerows(stats)

    fudge_headers(response, stats)
    response['Content-Type'] = 'text/csv; charset=utf-8'
    return response
Set database sequence objects to match the source db
dataset/ETHPy150Open mozilla/addons-server/src/olympia/stats/views.py/render_csv--crossover with--dataset/ETHPy150Open catherinedevlin/ddl-generator/ddlgenerator/ddlgenerator.py/emit_db_sequence_updates