@@ -101,15 +101,11 @@ def _check_validity_period(self, data_node_config_id: str, data_node_config: Dat
101
101
f" None or populated with a timedelta value." ,
102
102
)
103
103
104
- def _check_required_properties (self , data_node_config_id : str , data_node_config : DataNodeConfig ):
105
- storage_type = data_node_config .storage_type
106
- if not storage_type or storage_type not in DataNodeConfig ._REQUIRED_PROPERTIES :
107
- return
108
-
109
- required_properties = DataNodeConfig ._REQUIRED_PROPERTIES [storage_type ]
104
+ @staticmethod
105
+ def __get_sql_required_properties (storage_type : str , dn_config_properties : Dict ) -> List :
110
106
if storage_type == DataNodeConfig ._STORAGE_TYPE_VALUE_SQL :
111
- if data_node_config . properties :
112
- if engine := data_node_config . properties .get (DataNodeConfig ._REQUIRED_DB_ENGINE_SQL_PROPERTY ):
107
+ if dn_config_properties :
108
+ if engine := dn_config_properties .get (DataNodeConfig ._REQUIRED_DB_ENGINE_SQL_PROPERTY ):
113
109
if engine == DataNodeConfig ._DB_ENGINE_SQLITE :
114
110
required_properties = [
115
111
DataNodeConfig ._REQUIRED_DB_NAME_SQL_PROPERTY ,
@@ -126,9 +122,10 @@ def _check_required_properties(self, data_node_config_id: str, data_node_config:
126
122
DataNodeConfig ._REQUIRED_READ_QUERY_SQL_PROPERTY ,
127
123
DataNodeConfig ._REQUIRED_WRITE_QUERY_BUILDER_SQL_PROPERTY ,
128
124
]
125
+ return required_properties
129
126
if storage_type == DataNodeConfig ._STORAGE_TYPE_VALUE_SQL_TABLE :
130
- if data_node_config . properties :
131
- if engine := data_node_config . properties .get (DataNodeConfig ._REQUIRED_DB_ENGINE_SQL_PROPERTY ):
127
+ if dn_config_properties :
128
+ if engine := dn_config_properties .get (DataNodeConfig ._REQUIRED_DB_ENGINE_SQL_PROPERTY ):
132
129
if engine == DataNodeConfig ._DB_ENGINE_SQLITE :
133
130
required_properties = [
134
131
DataNodeConfig ._REQUIRED_DB_NAME_SQL_PROPERTY ,
@@ -143,7 +140,25 @@ def _check_required_properties(self, data_node_config_id: str, data_node_config:
143
140
DataNodeConfig ._REQUIRED_DB_ENGINE_SQL_PROPERTY ,
144
141
DataNodeConfig ._REQUIRED_TABLE_NAME_SQL_TABLE_PROPERTY ,
145
142
]
146
- for required_property in required_properties :
143
+ return required_properties
144
+ return []
145
+
146
+ def __storage_type_specific_required_properties (self , storage_type : str , dn_config_properties : Dict ) -> List :
147
+ if storage_type in (DataNodeConfig ._STORAGE_TYPE_VALUE_SQL_TABLE , DataNodeConfig ._STORAGE_TYPE_VALUE_SQL ):
148
+ return self .__get_sql_required_properties (storage_type , dn_config_properties )
149
+ return []
150
+
151
+ def _check_required_properties (self , data_node_config_id : str , data_node_config : DataNodeConfig ):
152
+ storage_type = data_node_config .storage_type
153
+ if not storage_type or storage_type not in DataNodeConfig ._REQUIRED_PROPERTIES :
154
+ return
155
+
156
+ required_properties = DataNodeConfig ._REQUIRED_PROPERTIES [storage_type ]
157
+ required_properties .extend (
158
+ self .__storage_type_specific_required_properties (storage_type , data_node_config .properties )
159
+ )
160
+
161
+ for required_property in set (required_properties ):
147
162
if not data_node_config .properties or required_property not in data_node_config .properties :
148
163
if data_node_config_id == DataNodeConfig ._DEFAULT_KEY :
149
164
self ._warning (
0 commit comments