raw SQL was annoying me so continuing to port stuff completely over to SQLalchemy