database package

This PR respects the new dev model and would therefore be merged to master. Older versions of this PR are #533 and #538.