From 5b64ce9ea6a0e2224167e5d2d405e212b165c90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E5=BA=B7?= <49478192+pengkang1991@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:14:09 +0800 Subject: [PATCH] add distinct tests --- sql/engines/tests.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/engines/tests.py b/sql/engines/tests.py index 50939b2d2a..68c5d41e4a 100644 --- a/sql/engines/tests.py +++ b/sql/engines/tests.py @@ -191,7 +191,14 @@ def test_filter_sql(self): banned_sql = "select user from user_table" check_result = new_engine.filter_sql(sql=banned_sql, limit_num=10) self.assertEqual(check_result, "select top 10 user from user_table") - + + def test_filter_sql_with_distinct(self): + new_engine = MssqlEngine(instance=self.ins1) + # 只抽查一个函数 + banned_sql = "select distinct * from user_table" + check_result = new_engine.filter_sql(sql=banned_sql, limit_num=10) + self.assertEqual(check_result, "select distinct top 10 user from user_table") + def test_execute_check(self): new_engine = MssqlEngine(instance=self.ins1) test_sql = (