If you directly manipulate the db, then it is up to you to make sure you don't break anything... I strongly encourage you to use the `calibredb` CLI backend, or if you need a lot of flexibility, using the calibre apis via `calibre-debug` python scripts. e.g.
Code:
def init_cache(library_path=None):
if not library_path:
from calibre.utils.config import prefs
library_path=prefs['library_path']
from calibre.db.backend import DB
from calibre.db.cache import Cache
backend = DB(library_path)
cache = Cache(backend)
cache.init()
return cache
This grants you access to the functions described in
API Documentation for the database interface