560c741511f3c5e7b496809c3a174953cd8241c6,pudl/load.py,,_csv_dump_load,#Any#Any#Any#Any#Any#,9

Before Change


    csvfile = os.path.join(csvdir, table_name + ".csv")
    df.to_csv(csvfile, index=False)
    tbl = pudl.models.entities.PUDLBase.metadata.tables[table_name]
    with open(csvfile, "r", encoding="utf8") as f:
        postgres_copy.copy_from(f, tbl, engine, columns=tuple(df.columns),
                                format="csv", header=True, delimiter=",")
    // TODO: For the CEMS, this function is called many times, but the CSV

After Change


    // max_size is in bytes; spill to disk if >2GB
    with tempfile.SpooledTemporaryFile(max_size=2*1024**3, encoding="utf8") as f:
        df.to_csv(f, index=False)
        f.seek(0)
        postgres_copy.copy_from(f, tbl, engine, columns=tuple(df.columns),
                                format="csv", header=True, delimiter=",")
        if keep_csv:
            import shutil
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: catalyst-cooperative/pudl
Commit Name: 560c741511f3c5e7b496809c3a174953cd8241c6
Time: 2018-06-15
Author: karldw@users.noreply.github.com
File Name: pudl/load.py
Class Name:
Method Name: _csv_dump_load


Project Name: deepchem/deepchem
Commit Name: 42038c294a32f708b41255a7f29164e5d094eeba
Time: 2017-03-06
Author: lilleswing@gmail.com
File Name: deepchem/utils/rdkit_util.py
Class Name:
Method Name: add_hydrogens_to_mol


Project Name: sony/nnabla
Commit Name: 5aa0e65747cd13c072749cbc7364f61bd149cadf
Time: 2020-03-24
Author: Yuchi.Wen@sony.com
File Name: python/src/nnabla/utils/save.py
Class Name:
Method Name: save