diff --git a/datajoint/autopopulate.py b/datajoint/autopopulate.py index d5cabe06..461972cf 100644 --- a/datajoint/autopopulate.py +++ b/datajoint/autopopulate.py @@ -105,8 +105,8 @@ def make(self, key): The method can be implemented either as: (a) Regular method: All three steps are performed in a single database transaction. The method must return None. - (b) Generator method: - The make method is split into three functions: + (b) Generator method: + The make method is split into three functions: - `make_fetch`: Fetches data from the parent tables. - `make_compute`: Computes secondary attributes based on the fetched data. - `make_insert`: Inserts the computed data into the current table. @@ -124,7 +124,7 @@ def make(self, key): self.make_insert(key, *computed_result) commit_transaction - + Importantly, the output of make_fetch is a tuple that serves as the input into `make_compute`. The output of `make_compute` is a tuple that serves as the input into `make_insert`. @@ -412,11 +412,10 @@ def _populate1( != deepdiff.DeepHash(fetched_data, ignore_iterable_order=False)[ fetched_data ] - ): # rollback due to referential integrity fail - self.connection.cancel_transaction() - logger.warning( - f"Referential integrity failed for {key} -> {self.target.full_table_name}") - return False + ): # raise error if fetched data has changed + raise DataJointError( + "Referential integrity failed! The `make_fetch` data has changed" + ) gen.send(computed_result) # insert except (KeyboardInterrupt, SystemExit, Exception) as error: