helper for accessing postgres database