Database api improvements