Removed raw SQL queries

I had a problem with this query on PostgreSQL 9.0:

```
SELECT tag.id, tag.name, tag.description, tag.fgcolor, tag.bgcolor, count(*)
FROM tag
INNER JOIN dashboard_tags
ON dashboard_tags.tag_id = tag.id
GROUP BY tag.id
ORDER BY tag.name
```

It seems that PostgreSQL supports grouping by primary key in version 9.1+. I replaced raw SQL queries with corresponding SQLAlchemy queries.