o-nikolas commented on code in PR #66721:
URL: https://github.com/apache/airflow/pull/66721#discussion_r3230342722
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/glue_catalog.py:
##########
@@ -336,3 +336,67 @@ def execute(self, context: Context) -> None:
else:
raise
self.log.info("Partition created.")
+
+
+class GlueCatalogBatchDeletePartitionOperator(AwsBaseOperator[AwsBaseHook]):
+ """
+ Delete one or more partitions from an AWS Glue Data Catalog table.
+
+ .. seealso::
+ For more information on how to use this operator, take a look at the
guide:
+ :ref:`howto/operator:GlueCatalogBatchDeletePartitionOperator`
+
+ :param database_name: The name of the database. (templated)
+ :param table_name: The name of the table. (templated)
+ :param partitions_to_delete: List of partition value lists to delete.
(templated)
Review Comment:
Is `partitions_to_delete` templated? I don't see it in the templated_fields
attribute below
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/glue_catalog.py:
##########
@@ -336,3 +336,67 @@ def execute(self, context: Context) -> None:
else:
raise
self.log.info("Partition created.")
+
+
+class GlueCatalogBatchDeletePartitionOperator(AwsBaseOperator[AwsBaseHook]):
+ """
+ Delete one or more partitions from an AWS Glue Data Catalog table.
+
+ .. seealso::
+ For more information on how to use this operator, take a look at the
guide:
+ :ref:`howto/operator:GlueCatalogBatchDeletePartitionOperator`
+
+ :param database_name: The name of the database. (templated)
+ :param table_name: The name of the table. (templated)
+ :param partitions_to_delete: List of partition value lists to delete.
(templated)
+ :param catalog_id: The ID of the Data Catalog. Defaults to the account ID.
(templated)
+ """
+
+ aws_hook_class = AwsBaseHook
+ template_fields: tuple[str, ...] = (
+ *AwsBaseOperator.template_fields,
+ "database_name",
+ "table_name",
+ "catalog_id",
+ )
Review Comment:
I know the rest of the Operators in this module probably use this approach
(it wasn't caught earlier) but there is a cleaner way that is used throughout
AMPP:
```suggestion
template_fields: tuple[str, ...] = aws_template_fields("database_name",
"table_name", "catalog_id", "partitions_to_delete")
```
--
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]