<commit_before>"""
This module handles database connections for suprabackup

"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

# This is used just for proxying models to db.models.<something>
from .. import models
from ..models.base import Model


def get_engine(engine, host, db, user, password=''):
    """
    Get the engine corresponding to the given parameters

    """
    user_string = "{}:{}".format(user, password)
    return create_engine('{}://{}@{}/{}'.format(engine, user_string, host, db))


def connect_engine(engine):
    """
    Get a session from an engine

    """
    return sessionmaker(bind=engine)


def connect(engine, host, db, user, password=''):
    """
    Connects to the database using the ORM and returns a db session

    """
    return connect_engine(get_engine(engine, host, db, user, password))<commit_msg>fixed connection to db<commit_after>"""
This module handles database connections for suprabackup

"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

# This is used just for proxying models to db.models.<something>
from .. import models
from ..models.base import Model


def get_engine(engine, host, db, user, password=''):
    """
    Get the engine corresponding to the given parameters

    """
    user_string = "{}:{}".format(user, password)
    return create_engine('{}://{}@{}/{}'.format(engine, user_string, host, db))


def connect_engine(engine):
    """
    Get a session from an engine

    """
    return sessionmaker(bind=engine)()


def connect(engine, host, db, user, password=''):
    """
    Connects to the database using the ORM and returns a db session

    """
    return connect_engine(get_engine(engine, host, db, user, password))
{'fraction_non_alphanumeric': 0.12293682413204325, 'fraction_numerical': 0.0, 'mean_word_length': 4.022857142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5186869', 'n_tokens_mistral': 509, 'n_tokens_neox': 488, 'n_words': 178}