def test_range_list_filter(self): expected_sql = QUERY_BASE.format("") expected_params = ["hg38", "E2F4", 18] query = RangeListQuery( schema="hg38", custom_list_id=18, model_name="E2F4", ) sql, params = query.get_query_and_params() self.assertEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_range_list_count(self): expected_sql = QUERY_WITH_COUNT.format("") expected_params = ["hg38", "E2F4", 48] query = RangeListQuery( schema="hg38", custom_list_id=48, model_name="E2F4", count=True, ) sql, params = query.get_query_and_params() self.maxDiff = None self.assertEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def test_range_list_filter_with_limit_multi_insert(self): expected_sql = QUERY_BASE.format(LIMIT_OFFSET) expected_params = ["hg38", "E2F4", 22, "100", "200"] query = RangeListQuery( schema="hg38", custom_list_id=22, model_name="E2F4", limit="100", offset="200", ) sql, params = query.get_query_and_params() self.assertEqual(expected_sql, sql) self.assertEqual(expected_params, params)
def range_list_query(self, count): custom_list_key, custom_list_filter = self.get_custom_list_fields() limit, offset = self.get_limit_and_offset(count) return RangeListQuery( schema=self.genome, custom_list_id=custom_list_key, model_name=self.args.get_model_name(), limit=limit, offset=offset, count=count, sort_by_max=self.args.get_sort_by_max(), )