moved all SQL queries into single Database module

Feels SQLAlchemy'ish!