Changed getRecords to use SQL API