{"id":20906,"library":"aimrocks","title":"aimrocks","description":"High-performance Python RocksDB wrapper implemented in Cython, based on facebook/rocksdb. Version 0.5.2 is the latest release, with sporadic updates. Aimed at users needing key-value storage with RocksDB's LSM-tree engine.","status":"active","version":"0.5.2","language":"python","source_language":"en","source_url":"https://github.com/aimhubio/aimrocks","tags":["rocksdb","key-value","database","storage","lsm-tree"],"install":[{"cmd":"pip install aimrocks","lang":"bash","label":"Install from PyPI"},{"cmd":"pip install aimrocks==0.5.2","lang":"bash","label":"Pin to latest version"}],"dependencies":[{"reason":"C library required; system-level installation of RocksDB may be needed (e.g., apt install librocksdb-dev).","package":"rocksdb","optional":true}],"imports":[{"note":"Standard usage: import rocksdb, not aimrocks directly.","symbol":"DB","correct":"import rocksdb\n\ndb = rocksdb.DB('/path/to/db', rocksdb.Options(create_if_missing=True))"},{"note":"aimrocks exposes components under the `rocksdb` namespace, not `aimrocks`.","wrong":"from aimrocks import Options","symbol":"Options","correct":"from rocksdb import Options"}],"quickstart":{"code":"import rocksdb\n\nopts = rocksdb.Options()\nopts.create_if_missing = True\ndb = rocksdb.DB('/tmp/test.db', opts)\ndb.put(b'key', b'value')\nprint(db.get(b'key'))\ndb.close()","lang":"python","description":"Open (or create) a RocksDB database, write and read a key-value pair."},"warnings":[{"fix":"Install RocksDB library: e.g., `apt-get install librocksdb-dev` (Debian/Ubuntu) or `brew install rocksdb` (macOS).","message":"RocksDB must be installed on the system (librocksdb-dev) before pip installing aimrocks. Missing system rocksdb will cause compilation failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `import rocksdb` instead of `import aimrocks`.","message":"aimrocks 0.5.x changed the namespace from `aimrocks` to `rocksdb`. Older code importing `aimrocks` directly will break.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Always encode strings to bytes: `db.put(b'key', b'value')` or `db.put('key'.encode(), 'value'.encode())`.","message":"Keys and values must be bytes objects. Passing strings will raise TypeError or silently fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use bytes: `db.put(b'key', b'value')`.","cause":"Passing string instead of bytes for key or value.","error":"TypeError: an integer is required (got type str)"},{"fix":"Install system RocksDB: `sudo apt-get install librocksdb-dev` (Linux) or `brew install rocksdb` (macOS).","cause":"RocksDB C++ library not installed on the system.","error":"ImportError: No module named 'rocksdb'"},{"fix":"Run `apt-get install build-essential python3-dev` beforehand.","cause":"Missing build tools or Python development headers.","error":"Compilation failed: unable to execute 'x86_64-linux-gnu-gcc'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}