🍓Strawberry Persisted Queries
Apollo-compatible persisted queries for Strawberry.
Usage
Add PersistedQueriesExtension() to your extensions.
import strawberry
from strawberry_persisted_queries import PersistedQueriesExtension
schema = strawberry.Schema(
query=Query,
extensions=[
PersistedQueriesExtension(),
],
)
Django
For Django users, a Django cache backend is available. This uses the default cache set in Django.
from strawberry_persisted_queries.django_cache import DjangoPersistedQueryCache
PersistedQueriesExtension(cache_backend=DjangoPersistedQueryCache())
Safelisted Queries
DictSafelist can be used to require persisted queries to already be saved.
This can be used with a build tool to ensure only queries used within an app are available.
from strawberry_persisted_queries.safelisting import DictSafelist
PersistedQueriesExtension(safelist=DictSafelist({
'sha256Hash': 'query {...}',
}))
Custom Cache Backends
Custom cache backends allow using another cache for persisted queries, such as memcached or a database.
Custom cache backends can inherit from strawberry_persisted_queries.PersistedQueryCache.
from strawberry_persisted_queries.cache import PersistedQueryCache
class MyCache(PersistedQueryCache):
def get(self, query_hash):
return cache.get(query_hash)
def set(self, query_hash, value):
cache.set(query_hash, value)
PersistedQueriesExtension(cache_backend=MyCache())
Release files for strawberry_persisted_queries 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| strawberry_persisted_queries-1.1.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| strawberry_persisted_queries-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / strawberry_persisted_queries-1.1.0.tar.gz
| Download URL | strawberry_persisted_queries-1.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32aa8afa40e9de10e62c2fb208f773ea939bc7ca4236e6471cf5c75c3100254b
|
|
BLAKE2b-256 checksum How to use checksums |
454dadea372d7aa3b617b088a42cc13b512ea549c51cd05f8bf32cde9aba4c1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1018-azure
|
Release files / strawberry_persisted_queries-1.1.0-py3-none-any.whl
| Download URL | strawberry_persisted_queries-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c581f0cb90d3cd85a548965c9fb36abd67204245aea077843133da91dd71477
|
|
BLAKE2b-256 checksum How to use checksums |
5c43177945d17d1ca8e7b6653b3c2718ba481df82182196d79e31d93d07a78ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1018-azure
|