{"library":"sqltrie","title":"SQLTrie","type":"library","description":"SQLTrie is a Python library that implements a SQL-based prefix tree (trie) data structure, drawing inspiration from `pygtrie` and `python-diskcache`. It enables efficient storage and retrieval of key-value pairs where keys are sequences (e.g., strings) and operations like prefix-based lookups are optimized. The current version, 0.11.2, was released in February 2025. Given its 'Development Status :: 1 - Planning', the release cadence is irregular and the API is evolving.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install sqltrie"],"cli":null},"imports":["from sqltrie import Trie"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/efiop/sqltrie","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sqltrie/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import os\nfrom sqltrie import Trie\n\ndb_path = 'my_sqltrie.db'\n\n# Ensure a clean slate for the example\nif os.path.exists(db_path):\n    os.remove(db_path)\n\n# Initialize a SQLTrie instance, typically taking a filename for SQLite storage.\n# Using a context manager ensures proper closing and data persistence.\nwith Trie(filename=db_path) as trie:\n    trie[\"apple\"] = 100\n    trie[\"apricot\"] = 200\n    trie[\"banana\"] = 300\n    trie[\"bandana\"] = 400\n    trie[\"applepie\"] = 50\n\n    print(f\"Value for 'apple': {trie['apple']}\")\n    print(f\"'banana' exists: {'banana' in trie}\")\n    print(f\"'grape' exists: {'grape' in trie}\")\n\n    print(\"\\nItems with prefix 'ap':\")\n    for key, value in trie.items(prefix=\"ap\"):\n        print(f\"  {key}: {value}\")\n\n    print(\"\\nAll items:\")\n    for key, value in trie.items():\n        print(f\"  {key}: {value}\")\n\n# Data is persisted after exiting the 'with' block.\n# To verify, load the trie again from the same file.\nwith Trie(filename=db_path) as loaded_trie:\n    print(f\"\\nValue for 'apricot' after reload: {loaded_trie['apricot']}\")\n    print(f\"'applepie' exists after reload: {'applepie' in loaded_trie}\")\n\n# Clean up the database file\nos.remove(db_path)\nprint(f\"\\nCleaned up database file '{db_path}'.\")","lang":"python","description":"This quickstart demonstrates common `SQLTrie` operations, including storing and retrieving values by key, checking key existence, and iterating over items with a given prefix. It highlights the use of a context manager for proper database handling and implicitly showcases data persistence in the SQLite backend.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"0.11.2","pypi_latest":"0.11.2","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"19.0M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.1,"import_time_s":null,"mem_mb":null,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"20.9M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2,"import_time_s":null,"mem_mb":null,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"12.8M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"12.5M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":"13M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"18.5M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"sqltrie","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"19M"}]}}