cthoyt / pystow

👜 Easily pick a place to store data for your Python code.
https://pystow.readthedocs.io
MIT License
36 stars 6 forks source link

Adds ensure gunzip command for single files #47

Closed cthoyt closed 2 years ago

cthoyt commented 2 years ago

Closes #45

This supports ensuring/unzipping GZ files. In addition, it wraps the sqlite opener for use cases like the following:

import pandas as pd

import pystow

if __name__ == "__main__":
    sql = "SELECT * FROM entailed_edge LIMIT 10"
    url = "https://s3.amazonaws.com/bbop-sqlite/hp.db.gz"
    with pystow.ensure_open_sqlite_gz("test", url=url) as conn:
        df = pd.read_sql(sql, conn)
    print(df)
codecov-commenter commented 2 years ago

Codecov Report

Merging #47 (383e6d6) into main (aa60314) will decrease coverage by 0.82%. The diff coverage is 23.52%.

@@            Coverage Diff             @@
##             main      #47      +/-   ##
==========================================
- Coverage   66.66%   65.83%   -0.83%     
==========================================
  Files          10       10              
  Lines         867      884      +17     
  Branches      145      147       +2     
==========================================
+ Hits          578      582       +4     
- Misses        268      281      +13     
  Partials       21       21              
Impacted Files Coverage Δ
src/pystow/__init__.py 100.00% <ø> (ø)
src/pystow/impl.py 72.87% <10.00%> (-2.66%) :arrow_down:
src/pystow/api.py 70.27% <33.33%> (-0.77%) :arrow_down:
src/pystow/utils.py 61.48% <50.00%> (-0.16%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us.