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.dev8.tar.gz
(12.1 kB
view hashes)
Built Distribution
Close
Hashes for liteindex-0.0.1.dev8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccdc179576e367dca81d3145ca5b7c4221863306c2aa90f2407bd1bbb32a9f01 |
|
MD5 | e584b9331f121f9d0723947284b59082 |
|
BLAKE2b-256 | ac77d7a0401f7753d977a38b7c9d319862973705f23145b6137253f3026e2e2c |