Draft implementation for sqlite (untested)