@@ -74,7 +74,7 @@ def custom_sql_creator(
74
74
dimension = dimension ,
75
75
custom_sql = custom_sql ,
76
76
description = description ,
77
- column_qualified_name = None ,
77
+ column = None ,
78
78
threshold_unit = None ,
79
79
)
80
80
return cls (attributes = attributes )
@@ -104,7 +104,7 @@ def table_level_rule_creator(
104
104
threshold_value = threshold_value ,
105
105
alert_priority = alert_priority ,
106
106
rule_name = None ,
107
- column_qualified_name = None ,
107
+ column = None ,
108
108
threshold_unit = None ,
109
109
dimension = None ,
110
110
custom_sql = None ,
@@ -120,22 +120,22 @@ def column_level_rule_creator(
120
120
client :AtlanClient ,
121
121
rule_type : str ,
122
122
asset : Asset ,
123
- column_qualified_name : str ,
123
+ column : Asset ,
124
124
threshold_compare_operator : alpha_DQRuleThresholdCompareOperator ,
125
125
threshold_value : float ,
126
126
alert_priority : alpha_DQRuleAlertPriority ,
127
127
threshold_unit : Optional [alpha_DQRuleThresholdUnit ] = None ,
128
128
) -> alpha_DQRule :
129
129
validate_required_fields (
130
- ["rule_type" , "asset" , "column_qualified_name " , "threshold_compare_operator" , "threshold_value" , "alert_priority" ],
131
- [rule_type , asset , column_qualified_name , threshold_compare_operator , threshold_value , alert_priority ],
130
+ ["rule_type" , "asset" , "column " , "threshold_compare_operator" , "threshold_value" , "alert_priority" ],
131
+ [rule_type , asset , column , threshold_compare_operator , threshold_value , alert_priority ],
132
132
)
133
133
134
134
attributes = alpha_DQRule .Attributes .creator (
135
135
client = client ,
136
136
rule_type = rule_type ,
137
137
asset = asset ,
138
- column_qualified_name = column_qualified_name ,
138
+ column = column ,
139
139
threshold_compare_operator = threshold_compare_operator ,
140
140
threshold_value = threshold_value ,
141
141
alert_priority = alert_priority ,
@@ -824,7 +824,7 @@ def _generate_config_arguments_raw(
824
824
compare_operator : alpha_DQRuleThresholdCompareOperator ,
825
825
threshold_value : float ,
826
826
threshold_unit : Optional [alpha_DQRuleThresholdUnit ] = None ,
827
- column_qualified_name : Optional [str ] = None ,
827
+ column : Optional [Asset ] = None ,
828
828
dq_priority : alpha_DQRuleAlertPriority ,
829
829
description : Optional [str ] = None
830
830
) -> str :
@@ -839,8 +839,8 @@ def _generate_config_arguments_raw(
839
839
"alpha_dqRuleTemplateAdvancedSettings.dqPriority" : dq_priority ,
840
840
}
841
841
842
- if column_qualified_name is not None :
843
- config ["alpha_dqRuleTemplateConfigBaseColumnQualifiedName" ] = column_qualified_name
842
+ if column is not None :
843
+ config ["alpha_dqRuleTemplateConfigBaseColumnQualifiedName" ] = column . qualified_name
844
844
845
845
if description is not None :
846
846
config ["alpha_dqRuleTemplateConfigUserDescription" ] = description
@@ -890,7 +890,7 @@ def creator(
890
890
threshold_compare_operator : alpha_DQRuleThresholdCompareOperator ,
891
891
threshold_value : float ,
892
892
alert_priority : alpha_DQRuleAlertPriority ,
893
- column_qualified_name : Optional [str ] = None ,
893
+ column : Optional [Asset ] = None ,
894
894
threshold_unit : Optional [alpha_DQRuleThresholdUnit ] = None ,
895
895
dimension : Optional [alpha_DQDimension ] = None ,
896
896
custom_sql : Optional [str ] = None ,
@@ -907,8 +907,10 @@ def creator(
907
907
.include_on_results (alpha_DQRuleTemplate .ALPHADQ_RULE_TEMPLATE_DIMENSION )
908
908
.include_on_results (alpha_DQRuleTemplate .ALPHADQ_RULE_TEMPLATE_CONFIG )
909
909
).to_request ()
910
+ present = False
910
911
for result in client .asset .search (request ):
911
912
if result .display_name == rule_type :
913
+ present = True
912
914
template_rule_name = result .name
913
915
template_qualified_name = result .qualified_name
914
916
@@ -922,8 +924,9 @@ def creator(
922
924
threshold_unit_field = properties .get ('alpha_dqRuleTemplateConfigThresholdUnit' , {})
923
925
default_value = threshold_unit_field .get ('default' )
924
926
threshold_unit = default_value
925
- # else:
926
- # raise ErrorCode.DQ_RULE_NOT_FOUND.exception_with_parameters(result.display_name)
927
+
928
+ if present == False :
929
+ raise ErrorCode .DQ_RULE_NOT_FOUND .exception_with_parameters (rule_type )
927
930
928
931
config_arguments_raw = alpha_DQRule .Attributes ._generate_config_arguments_raw (
929
932
is_alert_enabled = True ,
@@ -933,7 +936,7 @@ def creator(
933
936
compare_operator = threshold_compare_operator ,
934
937
threshold_value = threshold_value ,
935
938
threshold_unit = threshold_unit ,
936
- column_qualified_name = column_qualified_name ,
939
+ column = column ,
937
940
dq_priority = alert_priority ,
938
941
description = description ,
939
942
)
@@ -960,9 +963,9 @@ def creator(
960
963
alpha_dq_rule_template = alpha_DQRuleTemplate .ref_by_qualified_name (qualified_name = template_qualified_name ),
961
964
)
962
965
963
- if column_qualified_name is not None :
964
- attr_dq .alpha_dq_rule_base_column_qualified_name = column_qualified_name
965
- attr_dq .alpha_dq_rule_base_column = Column . ref_by_qualified_name ( qualified_name = column_qualified_name )
966
+ if column is not None :
967
+ attr_dq .alpha_dq_rule_base_column_qualified_name = column . qualified_name
968
+ attr_dq .alpha_dq_rule_base_column = column
966
969
967
970
if rule_type == "Custom SQL" :
968
971
attr_dq .alpha_dq_rule_custom_s_q_l = custom_sql
0 commit comments