@csrf_exempt
def sql_select(request):
    form = SQLSelectForm(request.POST or None)

    if form.is_valid():
        sql = form.cleaned_data['raw_sql']
        params = form.cleaned_data['params']
        cursor = form.cursor
        cursor.execute(sql, params)
        headers = [d[0] for d in cursor.description]
        result = cursor.fetchall()
        cursor.close()
        context = {
            'result': result,
            'sql': form.reformat_sql(),
            'duration': form.cleaned_data['duration'],
            'headers': headers,
            'alias': form.cleaned_data['alias'],
        }
        # Using render_to_response avoids running global context processors.
        return render_to_response('debug_toolbar/panels/sql_select.html', context)
    return HttpResponseBadRequest('Form errors')
Unit test of StartMapReduce().
dataset/ETHPy150Open django-debug-toolbar/django-debug-toolbar/debug_toolbar/panels/sql/views.py/sql_select--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/solutions-google-compute-engine-cluster-for-hadoop/gce_cluster_test.py/GceClusterTest.testStartMapReduce