skorper commented on code in PR #228: URL: https://github.com/apache/incubator-sdap-nexus/pull/228#discussion_r1105158834
########## analysis/webservice/algorithms/doms/ResultsStorage.py: ########## @@ -177,21 +180,43 @@ def __insertResult(self, execution_id, primaryId, result, batch, insertStatement dataMap = self.__buildDataMap(data_dict) result_id = uuid.uuid4() - batch.add(insertStatement, ( - result_id, - execution_id, - result["id"], - primaryId, - result["lon"], - result["lat"], - result["source"], - result["time"], - result["platform"] if "platform" in result else None, - result["device"] if "device" in result else None, - dataMap, - 1 if primaryId is None else 0, - result["depth"] - )) + + try: Review Comment: I'm wondering if something like this would be cleaner to avoid this try/catch and the many lines of log.error: ```python3 insert_params = ( result_id, execution_id, result["id"], primaryId, result["lon"], result["lat"], ... ) ... self._log.info('Inserting %s', insert_params) batch.add(insertStatement, insert_params) ``` ########## analysis/webservice/algorithms/doms/ResultsStorage.py: ########## @@ -177,21 +180,43 @@ def __insertResult(self, execution_id, primaryId, result, batch, insertStatement dataMap = self.__buildDataMap(data_dict) result_id = uuid.uuid4() - batch.add(insertStatement, ( - result_id, - execution_id, - result["id"], - primaryId, - result["lon"], - result["lat"], - result["source"], - result["time"], - result["platform"] if "platform" in result else None, - result["device"] if "device" in result else None, - dataMap, - 1 if primaryId is None else 0, - result["depth"] - )) + + try: + batch.add(insertStatement, ( + result_id, + execution_id, + result["id"], + primaryId, + result["lon"], + result["lat"], + result["source"], + result["time"], + result["platform"] if "platform" in result else None, + result["device"] if "device" in result else None, + dataMap, + 1 if primaryId is None else 0, + result["depth"] + )) + except: Review Comment: This is not where the SQL query is actually executed -- the query is added to the batch and it's executed on line 172. So I don't think this would have the desired behavior -- 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: dev-unsubscr...@sdap.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org