Try and protect from passing in the wrong arguments into the db api

Also get_resources() takes start/stop_timestamp not start/stop.
There might be a better way of doing this...
This function is getting ugly.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>