Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite manager? #68

Open
nk9 opened this issue Jan 21, 2024 · 3 comments
Open

SQLite manager? #68

nk9 opened this issue Jan 21, 2024 · 3 comments

Comments

@nk9
Copy link

nk9 commented Jan 21, 2024

I have an http cache that I've built up using Python requests-cache. It's in an SQLite database, as is the default for that project. I'm considering porting the scraper to Rust, but I don't want to lose the gigabytes of cached responses I've already fetched.

Is there a staightforward way to use this SQLite database with http-cache? It looks like the existing DB uses Python pickle to serialize the data, so… I'm guessing not. But I thought I'd ask just in case anyone has addressed this use case before.

@06chaynes
Copy link
Owner

06chaynes commented Jan 21, 2024

A cache manager implementation that uses SQLite for the backend can be created, and would probably be fairly easy to implement. The cache manager handles serialization/deserialization so you would need to make sure that logic reflects your existing structure properly. I think this would be achievable but there could always be some unknown I have yet to stumble upon.

Also this may be useful for the serialization/deserialization logic https://docs.rs/serde-pickle/latest/serde_pickle/. I haven't tried this myself as I don't use pickle but it looks promising.

@veeshi
Copy link
Contributor

veeshi commented Feb 10, 2024

I know this isn't exactly what you're looking for but for others looking for an SQLite cache manager, I previously implemented an MVP to trial using SQLite https://github.com/nethunterslabs/http-cache/tree/manager-sqlite.

@nk9
Copy link
Author

nk9 commented Feb 10, 2024

That's a huge help, thank you! I'll have a look at modifying your code for my purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants