Skip to content

Commit

Permalink
Update history record dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Sep 25, 2024
1 parent e680cc2 commit e80556c
Showing 1 changed file with 32 additions and 13 deletions.
45 changes: 32 additions & 13 deletions src/databricks/labs/ucx/progress/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,37 @@
logger = logging.getLogger(__name__)


@dataclass
class Record:
workspace_id: int # The workspace id
run_id: int # The workflow run id that crawled the objects
run_start_time: dt.datetime # The workflow run timestamp that crawled the objects
object_type: str # The object type, e.g. TABLE, VIEW. Forms a composite key together with object_id
object_id: str # The object id, e.g. hive_metastore.database.table. Forms a composite key together with object_id
object_data: str # The object data; the attributes of the corresponding ucx data class, e.g. table name, table ...
failures: list[str] # The failures indicating the object is not UC compatible
owner: str # The object owner
ucx_version: str # The ucx semantic version
snapshot_id: int # An identifier for the snapshot
@dataclass(frozen=True, kw_only=True)
class HistoricalRecord:
workspace_id: int
"""The identifier of the workspace where this record was generated."""

run_id: int
"""An identifier of the workflow run that generated this record."""

snapshot_id: int
"""An identifier that is unique to the records produced for a given snapshot."""

run_start_time: dt.datetime
"""When this record was generated."""

object_type: str
"""The inventory table for which this record was generated."""

object_type_version: int
"""Versioning of inventory table, for forward compatibility."""

object_id: list[str]
"""The type-specific identifier for this inventory record."""

object_data: str
"""Type-specific JSON-encoded data of the inventory record."""

object_owner: str
"""The identity that has ownership of the object."""

failures: list[str]
"""The list of problems associated with the object that this inventory record covers."""


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

def run(self) -> None:
self._create_schema()
self._create_table("records", Record)
self._create_table("records", HistoricalRecord)
logger.info("Installation completed successfully!")

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

0 comments on commit e80556c

Please sign in to comment.