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

Add sqlite support #92

Merged
merged 8 commits into from
Oct 25, 2023
Merged

Add sqlite support #92

merged 8 commits into from
Oct 25, 2023

Conversation

karpetrosyan
Copy link
Owner

Closes #89

This pull request adds basic sqlite3 support for all kinds of serializers and can work on top of either trio or asyncio.

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #92 (626b695) into master (352ba73) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 626b695 differs from pull request most recent head a4d177e. Consider uploading reports for the commit a4d177e to get more accurate results

@@            Coverage Diff             @@
##            master       #92    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           27        27            
  Lines         1566      1666   +100     
==========================================
+ Hits          1566      1666   +100     
Files Coverage Δ
hishel/_async/_storages.py 100.00% <100.00%> (ø)
tests/_async/test_storages.py 100.00% <100.00%> (ø)
tests/_sync/test_storages.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@karpetrosyan
Copy link
Owner Author

I've added a section where I've outlined the storage options that can be used in each scenario.

Installing sqlite extra for the asynchronous support of sqlite3 is necessary if you want to use the async version of hishel.

pip install hishel[sqlite]

Hishel uses anysqlite library for the asynchronous sqlite3 support.

Also, you can ass your own sqlite3 connections if you want, like so:

import hishel
import sqlite3

client = hishel.CacheClient(
    storage=hishel.SQLiteStorage(connection=sqlite3.connect("my_db_path", timeout=5))
)

@karpetrosyan karpetrosyan merged commit 510ea33 into master Oct 25, 2023
5 checks passed
@karpetrosyan karpetrosyan mentioned this pull request Oct 25, 2023
@karpetrosyan karpetrosyan deleted the add-sqlite-support branch November 22, 2023 05:22
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

Successfully merging this pull request may close these issues.

Add sqlite3 support
1 participant