<commit_before>from IPython.terminal.embed import embed

from db import *

embed()
<commit_msg>Start shell only if database exists<commit_after>from IPython.terminal.embed import embed
from sqlalchemy.exc import OperationalError

from db import engine


def database_exists():
    try:
        engine.connect()
        return True
    except OperationalError:
        print('The database "sqlalchemy_tutorial" did not exist')
        print('Please run commands below')
        print('--------------------------------------')
        print('createdb sqlalchemy_tutorial')
        print('psql sqlalchemy_tutorial < world.sql')
        print('--------------------------------------')
        return False


if database_exists():
    embed()

{'fraction_non_alphanumeric': 0.17750677506775067, 'fraction_numerical': 0.0, 'mean_word_length': 2.185344827586207, 'pattern_counts': {'":': 0, '<': 4, '<?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': '841245', 'n_tokens_mistral': 194, 'n_tokens_neox': 182, 'n_words': 55}