New DB interface.

Includes support for both csv and postgress output.