CamilleTeruel commented on code in PR #7032:
URL: 
https://github.com/apache/incubator-devlake/pull/7032#discussion_r1503893596


##########
backend/python/pydevlake/pydevlake/model.py:
##########
@@ -125,13 +128,17 @@ def set_tool_origin(self, tool_model: 'ToolModel'):
 
 
 class NoPKModel(RawDataOrigin):
-    created_at: Optional[datetime] = Field(
+    created_at:  [datetime] = Field(

Review Comment:
   If you want to make `created_at` non optional, remove the brackets.
   But making it non optional means that `created_at` has to be passed each 
time when instanciating models, which is not what we want here I suspect.
   
   BTW, I think we don't need to use `sa_column` anymore to set default with 
SQLModel. 
   Maybe this works? `Field(default=datetime.utcnow(), nullable=False)`



##########
backend/python/pydevlake/pydevlake/subtasks.py:
##########
@@ -206,9 +207,13 @@ def process(self, tool_model: ToolModel, session: Session, 
ctx: Context):
 
     def _save(self, tool_model: ToolModel, domain_model: DomainModel, session: 
Session, connection_id: int):
         domain_model.set_tool_origin(tool_model)
+        domain_model.set_updated_at()
         if isinstance(domain_model, DomainModel):
             domain_model.id = tool_model.domain_id()
         session.merge(domain_model)
 
     def delete(self, session, ctx):
-        pass
\ No newline at end of file
+        domain_models = self.stream.domain_tables
+        if domain_models is not None:
+            for domain_model in domain_models:
+                
session.execute(sql.delete(domain_model).where(domain_model.raw_data_params == 
self._params(ctx)))

Review Comment:
   missing new line



##########
backend/python/pydevlake/pydevlake/model.py:
##########
@@ -125,13 +128,17 @@ def set_tool_origin(self, tool_model: 'ToolModel'):
 
 
 class NoPKModel(RawDataOrigin):
-    created_at: Optional[datetime] = Field(
+    created_at:  Optional[datetime] = Field(

Review Comment:
   extra space



##########
backend/python/plugins/azuredevops/azuredevops/streams/jobs.py:
##########
@@ -28,6 +28,7 @@ class Jobs(Substream):
     tool_model = Job
     domain_types = [DomainType.CICD]
     parent_stream = Builds
+    domain_tables = [devops.CICDTask]

Review Comment:
   Rename to `domain_models` in case you keep that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to