<commit_before>#!/bin/bash

# small helper to drop all tables from a give db
DB=$1

echo dropping tables from ${DB}

PGDB="-h localhost -W -U hostview ${DB}"

TABLES=`psql $PGDB -t --command "SELECT string_agg(table_name, ',') FROM information_schema.tables WHERE table_schema='public'"`

echo dropping tables:${TABLES}

#psql $PGDB --command "DROP TABLE IF EXISTS ${TABLES} CASCADE"<commit_msg>drop script y/n<commit_after>#!/bin/bash

# small helper to drop all tables from a give db
DB=$1

while true; do
    read -p "Do you really want to drop all tables from ${DB} [yn]?" yn
    case $yn in
        [Yy]* ) break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes [Yy] or no [Nn].";;
    esac
done

PGDB="-h localhost -W -U hostview ${DB}"
TABLES=`psql $PGDB -t --command "SELECT string_agg(table_name, ',') FROM information_schema.tables WHERE table_schema='public'"`

echo dropping tables:${TABLES}

psql $PGDB --command "DROP TABLE IF EXISTS ${TABLES} CASCADE"
{'fraction_non_alphanumeric': 0.14212678936605316, 'fraction_numerical': 0.002044989775051125, 'mean_word_length': 3.895, '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': '1133512', 'n_tokens_mistral': 347, 'n_tokens_neox': 333, 'n_words': 120}