@@ -1281,17 +1281,17 @@ def delete_staged_data(self, symbol: str):
1281
1281
def finalize_staged_data (
1282
1282
self ,
1283
1283
symbol : str ,
1284
- mode : Optional [StagedDataFinalizeMethod ] = StagedDataFinalizeMethod .WRITE ,
1284
+ mode : Optional [Union [ StagedDataFinalizeMethod , str ] ] = StagedDataFinalizeMethod .WRITE ,
1285
1285
prune_previous_versions : bool = False ,
1286
1286
metadata : Any = None ,
1287
1287
validate_index = True ,
1288
1288
delete_staged_data_on_failure : bool = False
1289
1289
) -> VersionedItem :
1290
1290
"""
1291
1291
Finalizes staged data, making it available for reads. All staged segments must be ordered and non-overlapping.
1292
- ``finalize_staged_data`` is less time consuming than ``sort_and_finalize_staged_data``.
1292
+ ``finalize_staged_data`` is less time- consuming than ``sort_and_finalize_staged_data``.
1293
1293
1294
- If ``mode`` is ``StagedDataFinalizeMethod.APPEND`` the index of the first row of the new segment must be equal to or greater
1294
+ If ``mode`` is ``StagedDataFinalizeMethod.APPEND`` or ``APPEND`` the index of the first row of the new segment must be equal to or greater
1295
1295
than the index of the last row in the existing data.
1296
1296
1297
1297
If ``Static Schema`` is used all staged block must have matching schema (same column names, same dtype, same column ordering)
@@ -1310,9 +1310,9 @@ def finalize_staged_data(
1310
1310
symbol : `str`
1311
1311
Symbol to finalize data for.
1312
1312
1313
- mode : `StagedDataFinalizeMethod`, default=StagedDataFinalizeMethod.WRITE
1314
- Finalize mode. Valid options are WRITE or APPEND. Write collects the staged data and writes them to a
1315
- new version. Append collects the staged data and appends them to the latest version.
1313
+ mode : Union[ `StagedDataFinalizeMethod`, str] , default=StagedDataFinalizeMethod.WRITE
1314
+ Finalize mode. Valid options are StagedDataFinalizeMethod. WRITE or StagedDataFinalizeMethod. APPEND. Write collects the staged data and writes them to a
1315
+ new version. Append collects the staged data and appends them to the latest version. Also accepts "WRITE" and "APPEND".
1316
1316
prune_previous_versions: bool, default=False
1317
1317
Removes previous (non-snapshotted) versions from the database.
1318
1318
metadata : Any, default=None
@@ -1383,9 +1383,12 @@ def finalize_staged_data(
1383
1383
2024-01-03 3
1384
1384
2024-01-04 4
1385
1385
"""
1386
+ if not (mode is None or isinstance (mode , StagedDataFinalizeMethod ) or mode == "WRITE" or mode == "APPEND" ):
1387
+ raise ArcticInvalidApiUsageException ("mode must be a StagedDataFinalizeMethod enum or 'WRITE'/'APPEND'" )
1388
+
1386
1389
return self ._nvs .compact_incomplete (
1387
1390
symbol ,
1388
- append = mode == StagedDataFinalizeMethod .APPEND ,
1391
+ append = mode == StagedDataFinalizeMethod .APPEND or mode == "APPEND" ,
1389
1392
convert_int_to_float = False ,
1390
1393
metadata = metadata ,
1391
1394
prune_previous_version = prune_previous_versions ,
0 commit comments