SQLite based queryable python indexes for dicts and lists
Project description
LiteIndex
ultra fast, thread and process safe, easily queryable Indexes for Python.
DefinedIndex
from liteindex import DefinedIndex
# Define the schema for the index
schema = {
"name": "",
"age": 0,
"address": {
"street": "",
"city": "",
"country": ""
}
}
# Create a DefinedIndex instance
index = DefinedIndex(name="people", schema=schema)
# Insert or update a single item in the index
index.set("1", {
"name": "Alice",
"age": 30,
"address": {
"street": "123 Main St",
"city": "New York",
"country": "USA"
}
})
# Query the index to retrieve items based on certain conditions
# (e.g., age <= 25, city = "New York")
query = {
"age": (None, 25),
"address": {
"city": "New York"
}
}
results = index.search(query)
for result in results:
print(f"ID: {result['id']}, Name: {result['name']}, Age: {result['age']}, Address: {result['address']}")
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
liteindex-0.0.1.dev9.tar.gz
(15.0 kB
view hashes)
Built Distribution
Close
Hashes for liteindex-0.0.1.dev9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4269d26fb3433c6863d5d0c46c5f43575bd2038019817739562b225e1827d7b4 |
|
MD5 | febfa30e07a5d3269c8d201e38fefbeb |
|
BLAKE2b-256 | 60255f26e60150fe63bbd600bc0ebef2ac697897bc6b1f416162444df687387f |