Skip to content

Commit 4eb42f1

Browse files
committed
Update history record dataclass
1 parent f93e1ed commit 4eb42f1

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

src/databricks/labs/ucx/progress/install.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,37 @@
1212
logger = logging.getLogger(__name__)
1313

1414

15-
@dataclass
16-
class Record:
17-
workspace_id: int # The workspace id
18-
run_id: int # The workflow run id that crawled the objects
19-
run_start_time: dt.datetime # The workflow run timestamp that crawled the objects
20-
object_type: str # The object type, e.g. TABLE, VIEW. Forms a composite key together with object_id
21-
object_id: str # The object id, e.g. hive_metastore.database.table. Forms a composite key together with object_id
22-
object_data: str # The object data; the attributes of the corresponding ucx data class, e.g. table name, table ...
23-
failures: list[str] # The failures indicating the object is not UC compatible
24-
owner: str # The object owner
25-
ucx_version: str # The ucx semantic version
26-
snapshot_id: int # An identifier for the snapshot
15+
@dataclass(frozen=True, kw_only=True)
16+
class HistoricalRecord:
17+
workspace_id: int
18+
"""The identifier of the workspace where this record was generated."""
19+
20+
run_id: int
21+
"""An identifier of the workflow run that generated this record."""
22+
23+
snapshot_id: int
24+
"""An identifier that is unique to the records produced for a given snapshot."""
25+
26+
run_start_time: dt.datetime
27+
"""When this record was generated."""
28+
29+
object_type: str
30+
"""The inventory table for which this record was generated."""
31+
32+
object_type_version: int
33+
"""Versioning of inventory table, for forward compatibility."""
34+
35+
object_id: list[str]
36+
"""The type-specific identifier for this inventory record."""
37+
38+
object_data: str
39+
"""Type-specific JSON-encoded data of the inventory record."""
40+
41+
object_owner: str
42+
"""The identity that has ownership of the object."""
43+
44+
failures: list[str]
45+
"""The list of problems associated with the object that this inventory record covers."""
2746

2847

2948
class HistoryInstallation:
@@ -40,7 +59,7 @@ def __init__(self, sql_backend: SqlBackend, ucx_catalog: str) -> None:
4059

4160
def run(self) -> None:
4261
self._create_schema()
43-
self._create_table("records", Record)
62+
self._create_table("records", HistoricalRecord)
4463
logger.info("Installation completed successfully!")
4564

4665
@retried(on=[InternalError], timeout=dt.timedelta(minutes=1))

0 commit comments

Comments
 (0)