@@ -115,6 +115,7 @@ async def create(
115115 source_params : dict [str , Any ],
116116 target_params : dict [str , Any ],
117117 strategy_params : dict [str , Any ],
118+ transformations : list [dict [str , Any ]],
118119 queue_id : int ,
119120 is_scheduled : bool ,
120121 schedule : str | None ,
@@ -130,6 +131,7 @@ async def create(
130131 source_params = source_params ,
131132 target_params = target_params ,
132133 strategy_params = strategy_params ,
134+ transformations = transformations ,
133135 queue_id = queue_id ,
134136 is_scheduled = is_scheduled ,
135137 schedule = schedule or "" ,
@@ -154,20 +156,27 @@ async def update(
154156 source_params : dict [str , Any ],
155157 target_params : dict [str , Any ],
156158 strategy_params : dict [str , Any ],
159+ transformations : list [dict [str , Any ]],
157160 is_scheduled : bool | None ,
158161 schedule : str | None ,
159162 new_queue_id : int | None ,
160163 ) -> Transfer :
161164 try :
162- for key in transfer .source_params :
163- if key not in source_params or source_params [key ] is None :
164- source_params [key ] = transfer .source_params [key ]
165- for key in transfer .target_params :
166- if key not in target_params or target_params [key ] is None :
167- target_params [key ] = transfer .target_params [key ]
168- for key in transfer .strategy_params :
169- if key not in strategy_params or strategy_params [key ] is None :
170- strategy_params [key ] = transfer .strategy_params [key ]
165+ for old , new in [
166+ (transfer .source_params , source_params ),
167+ (transfer .target_params , target_params ),
168+ (transfer .strategy_params , strategy_params ),
169+ ]:
170+ for key in old :
171+ if key not in new or new [key ] is None :
172+ new [key ] = old [key ]
173+
174+ new_transformations = {d ["type" ]: d ["filters" ] for d in transformations }
175+ old_transformations = {d ["type" ]: d ["filters" ] for d in transfer .transformations }
176+ for t_type , t_filters in new_transformations .items ():
177+ old_transformations [t_type ] = t_filters
178+ transformations = [{"type" : t , "filters" : f } for t , f in old_transformations .items ()]
179+
171180 return await self ._update (
172181 Transfer .id == transfer .id ,
173182 name = name or transfer .name ,
@@ -179,6 +188,7 @@ async def update(
179188 target_connection_id = target_connection_id or transfer .target_connection_id ,
180189 source_params = source_params ,
181190 target_params = target_params ,
191+ transformations = transformations ,
182192 queue_id = new_queue_id or transfer .queue_id ,
183193 )
184194 except IntegrityError as e :
0 commit comments