@@ -22,17 +22,33 @@ class DQCondition(AtlanObject):
2222 )
2323 min_value : Optional [int ] = Field (default = None , description = "" )
2424 max_value : Optional [int ] = Field (default = None , description = "" )
25+ reference_table : Optional [str ] = Field (default = None , description = "" )
26+ reference_column : Optional [str ] = Field (default = None , description = "" )
27+ target_table : Optional [str ] = Field (default = None , description = "" )
28+ target_column : Optional [str ] = Field (default = None , description = "" )
2529
2630 def __init__ (
2731 self ,
2832 type : DataQualityRuleTemplateConfigRuleConditions ,
2933 value : Optional [Union [str , int , List [str ], Dict [str , Any ]]] = None ,
3034 min_value : Optional [int ] = None ,
3135 max_value : Optional [int ] = None ,
36+ reference_table : Optional [str ] = None ,
37+ reference_column : Optional [str ] = None ,
38+ target_table : Optional [str ] = None ,
39+ target_column : Optional [str ] = None ,
3240 ** kwargs ,
3341 ):
3442 super ().__init__ (
35- type = type , value = value , min_value = min_value , max_value = max_value , ** kwargs
43+ type = type ,
44+ value = value ,
45+ min_value = min_value ,
46+ max_value = max_value ,
47+ reference_table = reference_table ,
48+ reference_column = reference_column ,
49+ target_table = target_table ,
50+ target_column = target_column ,
51+ ** kwargs ,
3652 )
3753
3854 if (
@@ -60,6 +76,23 @@ def __init__(
6076 "min_value, max_value" ,
6177 "min_value <= max_value" ,
6278 )
79+ elif self .type == DataQualityRuleTemplateConfigRuleConditions .IN_LIST_REFERENCE :
80+ validate_required_fields (
81+ ["reference_table" , "reference_column" ],
82+ [self .reference_table , self .reference_column ],
83+ )
84+ elif self .type == DataQualityRuleTemplateConfigRuleConditions .ROW_COUNT_RECON :
85+ validate_required_fields (["target_table" ], [self .target_table ])
86+ elif self .type in [
87+ DataQualityRuleTemplateConfigRuleConditions .AVERAGE_RECON ,
88+ DataQualityRuleTemplateConfigRuleConditions .SUM_RECON ,
89+ DataQualityRuleTemplateConfigRuleConditions .DUPLICATE_COUNT_RECON ,
90+ DataQualityRuleTemplateConfigRuleConditions .UNIQUE_COUNT_RECON ,
91+ ]:
92+ validate_required_fields (
93+ ["target_table" , "target_column" ],
94+ [self .target_table , self .target_column ],
95+ )
6396 else :
6497 validate_required_fields (["value" ], [self .value ])
6598 if self .type in [
@@ -81,6 +114,25 @@ def to_dict(self) -> Dict[str, Any]:
81114 == DataQualityRuleTemplateConfigRuleConditions .STRING_LENGTH_BETWEEN
82115 ):
83116 result ["value" ] = {"minValue" : self .min_value , "maxValue" : self .max_value }
117+ elif self .type == DataQualityRuleTemplateConfigRuleConditions .IN_LIST_REFERENCE :
118+ result ["value" ] = {
119+ "reference_table" : self .reference_table ,
120+ "reference_column" : self .reference_column ,
121+ }
122+ elif self .type == DataQualityRuleTemplateConfigRuleConditions .ROW_COUNT_RECON :
123+ result ["value" ] = {
124+ "target_table" : self .target_table ,
125+ }
126+ elif self .type in [
127+ DataQualityRuleTemplateConfigRuleConditions .AVERAGE_RECON ,
128+ DataQualityRuleTemplateConfigRuleConditions .SUM_RECON ,
129+ DataQualityRuleTemplateConfigRuleConditions .DUPLICATE_COUNT_RECON ,
130+ DataQualityRuleTemplateConfigRuleConditions .UNIQUE_COUNT_RECON ,
131+ ]:
132+ result ["value" ] = {
133+ "target_table" : self .target_table ,
134+ "target_column" : self .target_column ,
135+ }
84136 else :
85137 result ["value" ] = {"value" : self .value }
86138
@@ -99,6 +151,10 @@ def add_condition(
99151 value : Optional [Union [str , int , List [str ]]] = None ,
100152 min_value : Optional [int ] = None ,
101153 max_value : Optional [int ] = None ,
154+ reference_table : Optional [str ] = None ,
155+ reference_column : Optional [str ] = None ,
156+ target_table : Optional [str ] = None ,
157+ target_column : Optional [str ] = None ,
102158 ) -> DQRuleConditionsBuilder :
103159 """
104160 Add a condition to the builder.
@@ -107,11 +163,22 @@ def add_condition(
107163 :param value: value of type str, int, or list depending on condition type
108164 :param min_value: minimum value for range-based conditions
109165 :param max_value: maximum value for range-based conditions
166+ :param reference_table: qualified name of the reference table for IN_LIST_REFERENCE condition
167+ :param reference_column: qualified name of the reference column for IN_LIST_REFERENCE condition
168+ :param target_table: qualified name of the target table for reconciliation conditions
169+ :param target_column: qualified name of the target column for reconciliation conditions (except ROW_COUNT_RECON)
110170 :returns: the builder for method chaining
111171 """
112172 self ._conditions .append (
113173 DQCondition (
114- type = type , value = value , min_value = min_value , max_value = max_value
174+ type = type ,
175+ value = value ,
176+ min_value = min_value ,
177+ max_value = max_value ,
178+ reference_table = reference_table ,
179+ reference_column = reference_column ,
180+ target_table = target_table ,
181+ target_column = target_column ,
115182 )
116183 )
117184 return self
0 commit comments