a9eb629bcfc8239e86916661f80f0bee9ca26b79,fonduer/snorkel/models/meta.py,,new_sessionmaker,#,37

Before Change


    // Otherwise any e.g. query starts a transaction, locking tables... very bad for e.g. multiple notebooks
    // open, multiple processes, etc.
    if snorkel_postgres:
        snorkel_engine = create_engine(snorkel_conn_string, isolation_level="AUTOCOMMIT")
    else:
        snorkel_engine = create_engine(snorkel_conn_string)

    // New sessionmaker

After Change


    // http://oddbird.net/2014/06/14/sqlalchemy-postgres-autocommit/
    // Otherwise any e.g. query starts a transaction, locking tables... very
    // bad for e.g. multiple notebooks open, multiple processes, etc.
    if Meta.snorkel_postgres and Meta.ready:
        snorkel_engine = create_engine(
            Meta.conn_string, isolation_level="AUTOCOMMIT")
    else:
        raise ValueError(
            "Meta variables have not been initialized with a postgres connection string."
        )

    // New sessionmaker
    SnorkelSession = sessionmaker(bind=snorkel_engine)
    return SnorkelSession

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: HazyResearch/fonduer
Commit Name: a9eb629bcfc8239e86916661f80f0bee9ca26b79
Time: 2018-03-29
Author: lwhsiao@stanford.edu
File Name: fonduer/snorkel/models/meta.py
Class Name:
Method Name: new_sessionmaker


Project Name: jhpyle/docassemble
Commit Name: aa1dfaca936ac5fdef81d6258e13d4b0be683286
Time: 2021-01-24
Author: jhpyle@gmail.com
File Name: docassemble_webapp/docassemble/webapp/jsonstore.py
Class Name:
Method Name:


Project Name: catalyst-cooperative/pudl
Commit Name: 155b618bc262b83f0a264fc895bb1da1546ae89d
Time: 2017-02-16
Author: zane.selvans@catalyst.coop
File Name: pudl/pudl.py
Class Name:
Method Name: init_db