get classes from sql