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": (">=", 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.dev7.tar.gz
(11.9 kB
view hashes)
Built Distribution
Close
Hashes for liteindex-0.0.1.dev7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25072ffb7f65699aa409e5beb69f230266a831caeef953961ee7e0e47a9f6a10 |
|
MD5 | 11212dd7393cd5152f9f0e0b7f13bbef |
|
BLAKE2b-256 | 3360905854385545e7b0d84d0a573545da5a7b07753a47fe4e05b90d0c23a3c1 |