<commit_before>import csv
import json
import os
import psycopg2
import requests
import time
from config.base import get_environment_variable
from django.http import HttpResponse
import wevote_functions.admin

logger = wevote_functions.admin.get_logger(__name__)


def retrieve_sql_tables_as_csv():
    """
    Extract the 15 database tables to CSV (pipe delimited) and send it to the developer's local WeVoteServer instance
    :return:
    """
    t0 = time.time()
    tables = {
        'ballot_ballotitem',
        'ballot_ballotreturned',
        'candidate_candidatecampaign',
        'candidate_candidatecampaignlist',
        'candidate_candidatetoofficelink',
        'election_election',
        'issue_issue',
        'issue_organizationlinktoissue',
        'measure_contestmeasure',
        'office_contestoffice',
        'office_contestofficevisitingotherelection',
        'organization_organization',
        'politician_politician',
        'polling_location_pollinglocation',
        'position_positionentered',
        'voter_guide_voterguide'
    }<commit_msg>New retrieveSQLTables API endpoint -- remove one incorrect table name<commit_after>import csv
import json
import os
import psycopg2
import requests
import time
from config.base import get_environment_variable
from django.http import HttpResponse
import wevote_functions.admin

logger = wevote_functions.admin.get_logger(__name__)


def retrieve_sql_tables_as_csv():
    """
    Extract the 15 database tables to CSV (pipe delimited) and send it to the developer's local WeVoteServer instance
    :return:
    """
    t0 = time.time()
    tables = {
        'ballot_ballotitem',
        'ballot_ballotreturned',
        'candidate_candidatecampaign',
        'candidate_candidatetoofficelink',
        'election_election',
        'issue_issue',
        'issue_organizationlinktoissue',
        'measure_contestmeasure',
        'office_contestoffice',
        'office_contestofficevisitingotherelection',
        'organization_organization',
        'politician_politician',
        'polling_location_pollinglocation',
        'position_positionentered',
        'voter_guide_voterguide'
    }
{'fraction_non_alphanumeric': 0.07225034514496088, 'fraction_numerical': 0.0036815462494247586, 'mean_word_length': 3.5961945031712474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '752911', 'n_tokens_mistral': 642, 'n_tokens_neox': 609, 'n_words': 135}