def METHOD_NAME(self):
    sort = '{"age": -1}'
    expected_sql = (
        "SELECT json FROM logger_instance WHERE"
        " xform_id = %s  AND CAST(json->>%s AS INT) > %s AND"
        " CAST(json->>%s AS INT) < %s AND deleted_at IS NULL"
        " ORDER BY  json->>%s DESC"
    )
    (sql, columns, params) = DataView.generate_query_string(
        self.data_view,
        self.start_index,
        self.limit,
        self.last_submission_time,
        self.all_data,
        sort,
    )
    self.assertEqual(sql, expected_sql)
    records = [
        record
        for record in DataView.query_iterator(sql, columns, params, self.count)
    ]
    self.assertTrue(self.is_sorted_desc([r.get("age") for r in records]))