@@ -425,23 +425,21 @@ def _get_partition_aspect(self, table: Table) -> Optional[str]:
425
425
def _get_dataset_properties_aspect (
426
426
self , dataset_name : str , table : Table
427
427
) -> DatasetPropertiesClass :
428
- additional_properties = {}
428
+ created : Optional [ TimeStampClass ] = None
429
429
custom_properties = table .metadata .properties .copy ()
430
430
custom_properties ["location" ] = table .metadata .location
431
431
custom_properties ["format-version" ] = str (table .metadata .format_version )
432
432
custom_properties ["partition-spec" ] = str (self ._get_partition_aspect (table ))
433
+ last_modified : Optional [int ] = table .metadata .last_updated_ms
433
434
if table .current_snapshot ():
434
435
custom_properties ["snapshot-id" ] = str (table .current_snapshot ().snapshot_id )
435
436
custom_properties ["manifest-list" ] = table .current_snapshot ().manifest_list
436
- additional_properties ["lastModified" ] = TimeStampClass (
437
- int (table .current_snapshot ().timestamp_ms )
438
- )
437
+ if not last_modified :
438
+ last_modified = int (table .current_snapshot ().timestamp_ms )
439
439
if "created-at" in custom_properties :
440
440
try :
441
441
dt = dateutil_parser .isoparse (custom_properties ["created-at" ])
442
- additional_properties ["created" ] = TimeStampClass (
443
- int (dt .timestamp () * 1000 )
444
- )
442
+ created = TimeStampClass (int (dt .timestamp () * 1000 ))
445
443
except Exception as ex :
446
444
LOGGER .warning (
447
445
f"Exception while trying to parse creation date { custom_properties ['created-at' ]} , ignoring: { ex } "
@@ -451,8 +449,10 @@ def _get_dataset_properties_aspect(
451
449
name = table .name ()[- 1 ],
452
450
description = table .metadata .properties .get ("comment" , None ),
453
451
customProperties = custom_properties ,
454
- lastModified = additional_properties .get ("lastModified" ),
455
- created = additional_properties .get ("created" ),
452
+ lastModified = TimeStampClass (last_modified )
453
+ if last_modified is not None
454
+ else None ,
455
+ created = created ,
456
456
qualifiedName = dataset_name ,
457
457
)
458
458
0 commit comments