yangyulely commented on code in PR #43456:
URL: https://github.com/apache/airflow/pull/43456#discussion_r1820413842
##########
providers/src/airflow/providers/amazon/aws/transfers/s3_to_dynamodb.py:
##########
@@ -237,10 +237,13 @@ def _load_into_existing_table(self) -> str:
total_items += page.get("Count", 0)
dynamodb_hook.write_batch_data(items=page["Items"])
self.log.info("Number of items loaded: %s", total_items)
- finally:
- self.log.info("Delete tmp DynamoDB table %s", self.tmp_table_name)
- client.delete_table(TableName=self.tmp_table_name)
- return
dynamodb_hook.get_conn().Table(self.dynamodb_table_name).table_arn
+ except Exception as e:
+ # Does not raise errors to keep previous behavior.
+ self.log.warning("Error while loading data from temp table,
deleting temp table. Error: %s", e)
+
+ self.log.info("Delete tmp DynamoDB table %s", self.tmp_table_name)
+ client.delete_table(TableName=self.tmp_table_name)
Review Comment:
Yes, maybe it's better to keep them in finally clause, in case of exception
not handled by the try clause.
--
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]