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.dev6.tar.gz
(11.9 kB
view hashes)
Built Distribution
Close
Hashes for liteindex-0.0.1.dev6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d83290f15078d5d09021f90565a1d2cd21500e6c60527a477a96e78b9e4ed16d |
|
MD5 | b4a667339cacf3999d51bf35a81f8a1a |
|
BLAKE2b-256 | e803f5deab02f36b5aa3c8ed77174f05a3ce66a24a5436402449c85df747faec |