Comments (4)
There are several different requests here, it would be helpful to have separate discussions for each of:
- Auto-decompression
- Ensure +
sqlite.connect
(done in #46) - Ensure + some SQLAlchemy functionality (not clear what you're asking for)
I'd suggest taking a look at a place where I already implemented something like this for ChEMBL's tar.gz'd SQLite dump: https://github.com/cthoyt/chembl-downloader/blob/d7100ba316f496ee4c36a2a684a2d9434391eb9c/src/chembl_downloader/api.py#L164-L183. Unfortunately connecting to a gzipped file from sqlite is a paid-only feature, otherwise it would be great to read them directly.
There's also already https://pystow.readthedocs.io/en/latest/api/pystow.ensure_untar.html, so I guess I could make an analog for gzip
from pystow.
from pystow.
yeah okay I think the solution is to have an ensure_gunzip
function and then double wrap the ensure sqlite and ensure_gunzip functions to get what you wanted
from pystow.
@cmungall solution is now available like:
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)
from pystow.
Related Issues (20)
- Potential naming conflicts with default pystow home directory name. HOT 8
- Confusing folder configuration HOT 1
- Joining to existing pystow path HOT 1
- Issue with directories containing dots
- Python 3.10 support
- Ensure zip file? HOT 3
- Bug in ensure_open_zip when using API HOT 2
- Variants of ensure functions focused on loading HOT 3
- Package on Anaconda via conda-forge? HOT 6
- Autogenerate README in .data folder HOT 1
- [WINDOWS] TypeError when using `ensure_csv`: "argument of type 'WindowsPath' is not iterable" HOT 1
- loading comma-separated values format defaults to tab separators
- Ensure from figshare
- Best practices for clearing stale files HOT 2
- Need to create a config file before it can be written to using write_config HOT 6
- Get configuration from file corresponding to leading part
- Alignment with platform-specific directories HOT 1
- Feature: Add progress bar during download HOT 2
- Raise error if directory passed as name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pystow.