|
| 1 | +import logging |
1 | 2 | import os |
2 | 3 | import shutil |
3 | 4 | from functools import cached_property |
4 | 5 |
|
5 | 6 | from databricks.labs.lsql.backends import SqlBackend, StatementExecutionBackend |
6 | 7 | from databricks.sdk import WorkspaceClient |
| 8 | +from databricks.sdk.errors import NotFound |
7 | 9 |
|
8 | 10 | from databricks.labs.ucx.assessment.aws import AWSResources |
9 | 11 | from databricks.labs.ucx.framework.utils import run_command |
|
15 | 17 | from databricks.labs.ucx.azure.locations import ExternalLocationsMigration |
16 | 18 | from databricks.labs.ucx.azure.resources import AzureAPIClient, AzureResources |
17 | 19 | from databricks.labs.ucx.contexts.application import CliContext |
| 20 | +from databricks.labs.ucx.hive_metastore.migration_status import MigrationIndex |
18 | 21 | from databricks.labs.ucx.source_code.base import CurrentSessionState |
19 | 22 | from databricks.labs.ucx.source_code.linters.context import LinterContext |
20 | 23 | from databricks.labs.ucx.source_code.linters.files import LocalFileMigrator, LocalCodeLinter |
21 | 24 | from databricks.labs.ucx.source_code.notebooks.loaders import NotebookLoader |
22 | 25 | from databricks.labs.ucx.workspace_access.clusters import ClusterAccess |
23 | 26 |
|
| 27 | +logger = logging.getLogger(__name__) |
| 28 | + |
24 | 29 |
|
25 | 30 | class WorkspaceContext(CliContext): |
26 | 31 | def __init__(self, ws: WorkspaceClient, named_parameters: dict[str, str] | None = None): |
@@ -180,7 +185,11 @@ class LocalCheckoutContext(WorkspaceContext): |
180 | 185 | for running local operations.""" |
181 | 186 |
|
182 | 187 | def linter_context_factory(self, session_state: CurrentSessionState | None = None): |
183 | | - index = self.tables_migrator.index() |
| 188 | + try: |
| 189 | + index = self.tables_migrator.index() |
| 190 | + except NotFound: |
| 191 | + logger.warning("Metastore does not seem to exist yet. Skipping loading of migration status.") |
| 192 | + index = MigrationIndex([]) |
184 | 193 | if session_state is None: |
185 | 194 | session_state = CurrentSessionState() |
186 | 195 | return LinterContext(index, session_state) |
|
0 commit comments