[ticket/305] Split up get_type_constraints()

B3P-305
[ticket/305] Add method for running sql query

B3P-305