@@ -31,7 +31,7 @@ def _update_if_necessary(
3131 if value is not None :
3232 if key not in dic or dic [key ] != value :
3333 dic [key ] = value
34- if mode in ("append" , "overwrite_partitions" ):
34+ if mode in ("append" , "overwrite_partitions" , "overwrite_files" ):
3535 return "update"
3636 return mode
3737
@@ -150,9 +150,10 @@ def _create_table( # noqa: PLR0912,PLR0915
150150
151151 client_glue = _utils .client (service_name = "glue" , session = boto3_session )
152152 skip_archive : bool = not catalog_versioning
153- if mode not in ("overwrite" , "append" , "overwrite_partitions" , "update" ):
153+ if mode not in ("overwrite" , "append" , "overwrite_partitions" , "overwrite_files" , " update" ):
154154 raise exceptions .InvalidArgument (
155- f"{ mode } is not a valid mode. It must be 'overwrite', 'append' or 'overwrite_partitions'."
155+ f"{ mode } is not a valid mode. It must be 'overwrite', "
156+ f"'append', 'overwrite_partitions' or 'overwrite_files'."
156157 )
157158 args : dict [str , Any ] = _catalog_id (
158159 catalog_id = catalog_id ,
@@ -304,7 +305,7 @@ def _create_parquet_table(
304305 _logger .debug ("catalog_table_input: %s" , catalog_table_input )
305306
306307 table_input : dict [str , Any ]
307- if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" )):
308+ if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" , "overwrite_files" )):
308309 table_input = catalog_table_input
309310
310311 is_table_updated = _update_table_input (table_input , columns_types )
@@ -366,7 +367,7 @@ def _create_orc_table(
366367 _logger .debug ("catalog_table_input: %s" , catalog_table_input )
367368
368369 table_input : dict [str , Any ]
369- if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" )):
370+ if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" , "overwrite_files" )):
370371 table_input = catalog_table_input
371372
372373 is_table_updated = _update_table_input (table_input , columns_types )
@@ -436,7 +437,7 @@ def _create_csv_table(
436437 _utils .check_schema_changes (columns_types = columns_types , table_input = catalog_table_input , mode = mode )
437438
438439 table_input : dict [str , Any ]
439- if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" )):
440+ if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" , "overwrite_files" )):
440441 table_input = catalog_table_input
441442
442443 is_table_updated = _update_table_input (table_input , columns_types , allow_reorder = False )
@@ -508,7 +509,7 @@ def _create_json_table(
508509 table_input : dict [str , Any ]
509510 if schema_evolution is False :
510511 _utils .check_schema_changes (columns_types = columns_types , table_input = catalog_table_input , mode = mode )
511- if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" )):
512+ if (catalog_table_input is not None ) and (mode in ("append" , "overwrite_partitions" , "overwrite_files" )):
512513 table_input = catalog_table_input
513514
514515 is_table_updated = _update_table_input (table_input , columns_types )
@@ -1098,7 +1099,7 @@ def create_csv_table(
10981099 If True and `mode="overwrite"`, creates an archived version of the table catalog before updating it.
10991100 schema_evolution
11001101 If True allows schema evolution (new or missing columns), otherwise a exception will be raised.
1101- (Only considered if dataset=True and mode in ("append", "overwrite_partitions"))
1102+ (Only considered if dataset=True and mode in ("append", "overwrite_partitions", "overwrite_files" ))
11021103 Related tutorial:
11031104 https://aws-sdk-pandas.readthedocs.io/en/3.11.0/tutorials/014%20-%20Schema%20Evolution.html
11041105 sep
@@ -1278,7 +1279,7 @@ def create_json_table(
12781279 If True and `mode="overwrite"`, creates an archived version of the table catalog before updating it.
12791280 schema_evolution
12801281 If True allows schema evolution (new or missing columns), otherwise a exception will be raised.
1281- (Only considered if dataset=True and mode in ("append", "overwrite_partitions"))
1282+ (Only considered if dataset=True and mode in ("append", "overwrite_partitions", "overwrite_files" ))
12821283 Related tutorial:
12831284 https://aws-sdk-pandas.readthedocs.io/en/3.11.0/tutorials/014%20-%20Schema%20Evolution.html
12841285 serde_library
0 commit comments