@@ -59,3 +59,51 @@ def test_include_empty_include_mask(mask):
5959 assert r"""AND (
6060 (c.table_name LIKE 'important%' ) OR (c.table_name LIKE '%useful[_]%' )
6161 )""" in query
62+
63+
64+ def test_table_set_only ():
65+ connection = Connection (sql_flavor = "postgresql" )
66+ table_group = TableGroup (
67+ table_group_schema = "test_schema" ,
68+ profiling_table_set = "users, orders, products" ,
69+ profiling_include_mask = "" ,
70+ profiling_exclude_mask = "" ,
71+ )
72+ sql_generator = RefreshDataCharsSQL (connection , table_group )
73+ criteria = sql_generator ._get_table_criteria ()
74+
75+ assert "IN ('users','orders','products')" in criteria
76+ assert "LIKE" not in criteria
77+
78+
79+ @pytest .mark .parametrize ("include" , ("" , None ))
80+ @pytest .mark .parametrize ("exclude" , ("" , None ))
81+ def test_no_filters (include , exclude ):
82+ connection = Connection (sql_flavor = "postgresql" )
83+ table_group = TableGroup (
84+ table_group_schema = "test_schema" ,
85+ profiling_table_set = "" ,
86+ profiling_include_mask = include ,
87+ profiling_exclude_mask = exclude ,
88+ )
89+ sql_generator = RefreshDataCharsSQL (connection , table_group )
90+ criteria = sql_generator ._get_table_criteria ()
91+
92+ assert criteria == ""
93+
94+
95+ def test_table_set_with_include_exclude ():
96+ connection = Connection (sql_flavor = "postgresql" )
97+ table_group = TableGroup (
98+ table_group_schema = "test_schema" ,
99+ profiling_table_set = "users, orders" ,
100+ profiling_include_mask = "important%" ,
101+ profiling_exclude_mask = "temp%" ,
102+ )
103+ sql_generator = RefreshDataCharsSQL (connection , table_group )
104+ criteria = sql_generator ._get_table_criteria ()
105+
106+ assert "IN ('users','orders')" in criteria
107+ assert "LIKE 'important%'" in criteria
108+ assert "AND NOT" in criteria
109+ assert "LIKE 'temp%'" in criteria
0 commit comments