Like React Query but for Python
Project description
Python Query
Python library heavily inspired by react-query.
Getting Started
Here is a compilation of some actions that are achievable with this library.
import asyncio
import python_query
async def function() -> None:
await asyncio.sleep(1)
return 2
async def main():
query_cache = python_query.QueryCache()
query_cache["query1"] = lambda: 1
query_cache["query2"] = function
assert await query_cache["query1"].fetch_async() == 1
assert await query_cache["query2"].fetch_async() == 2
query_cache["query1"] = lambda: 3
assert await query_cache["query1"].fetch_async() == 3
query_cache["parent", "child1", {"page": 1}] = lambda: 4
query_cache["parent", "child1", {
"page": 1, "per_page": 10}] = lambda: 5
queries = query_cache.get_queries_not_exact("parent")
queries2 = query_cache.get_queries_not_exact(["parent", "child1"])
queries3 = query_cache.get_queries_not_exact(
["parent", "child1", {"page": 1}])
assert len(queries) == 2
assert len(queries2) == 2
assert len(queries3) == 2
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-query-0.0.1b1.tar.gz
(42.1 kB
view hashes)
Built Distribution
Close
Hashes for python_query-0.0.1b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31458d6703d266d14e28de7e9f4b25e933799be0ffe0512efaa6f114860a2db1 |
|
MD5 | 4910ed14042f3db2ef5c97d60378199a |
|
BLAKE2b-256 | 213c33e2f0b363d5ca42a1f6bab5b5768a26b4046659983147055a584835a20e |