<commit_before>from contextlib import contextmanager

from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker


class Schema():

    def __init__(self, engine):

        self.engine = engine
        self.meta = MetaData(bind=self.engine)
        self.meta.reflect()

        self.Session = sessionmaker(bind=self.engine)

    def __getattr__(self, table_name):

        return self.meta.tables[table_name]

    @contextmanager
    def session(self):
        """Provides a transactional scope around a series of operations."""
        session = self.Session()
        try:
            yield session
            session.commit()
        except:
            session.rollback()<commit_msg>Adds execite method to schema<commit_after>from contextlib import contextmanager

from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker


class Schema():

    def __init__(self, engine):

        self.engine = engine
        self.meta = MetaData(bind=self.engine)
        self.meta.reflect()

        self.Session = sessionmaker(bind=self.engine)

    def __getattr__(self, table_name):

        return self.meta.tables[table_name]

    def execute(self, *args, **kwargs):
        with self.session() as session:
            session.execute(*args, **kwargs)

    @contextmanager
    def session(self):
        """Provides a transactional scope around a series of operations."""
        session = self.Session()
        try:
            yield session
            session.commit()
        except:
            session.rollback()
{'fraction_non_alphanumeric': 0.08958068614993647, 'fraction_numerical': 0.0, 'mean_word_length': 2.563348416289593, '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': '294921', 'n_tokens_mistral': 426, 'n_tokens_neox': 406, 'n_words': 113}