|
4 | 4 | from functools import partial |
5 | 5 |
|
6 | 6 | from databricks.labs.blueprint.parallel import Threads |
| 7 | +from databricks.sdk.errors import Unknown |
7 | 8 |
|
8 | 9 | from databricks.labs.ucx.framework.crawlers import CrawlerBase, SqlBackend |
9 | 10 | from databricks.labs.ucx.framework.utils import escape_sql_identifier |
@@ -66,13 +67,16 @@ def _crawl(self) -> Iterable[Udf]: |
66 | 67 | # "target schema <database> is not in the current catalog" |
67 | 68 | self._exec(f"USE CATALOG {escape_sql_identifier(catalog)};") |
68 | 69 | for (database,) in self._all_databases(): |
69 | | - logger.debug(f"[{catalog}.{database}] listing udfs") |
70 | | - for (udf,) in self._fetch( |
71 | | - f"SHOW USER FUNCTIONS FROM {escape_sql_identifier(catalog)}.{escape_sql_identifier(database)};" |
72 | | - ): |
73 | | - if udf.startswith(f"{catalog}.{database}"): |
74 | | - udf_name = udf[udf.rfind(".") + 1 :] # remove catalog and database info from the name |
75 | | - tasks.append(partial(self._describe, catalog, database, udf_name)) |
| 70 | + try: |
| 71 | + logger.debug(f"[{catalog}.{database}] listing udfs") |
| 72 | + for (udf,) in self._fetch( |
| 73 | + f"SHOW USER FUNCTIONS FROM {escape_sql_identifier(catalog)}.{escape_sql_identifier(database)};" |
| 74 | + ): |
| 75 | + if udf.startswith(f"{catalog}.{database}"): |
| 76 | + udf_name = udf[udf.rfind(".") + 1 :] # remove catalog and database info from the name |
| 77 | + tasks.append(partial(self._describe, catalog, database, udf_name)) |
| 78 | + except Unknown as err: |
| 79 | + logger.error(f"Problem with {database}: {err}") |
76 | 80 | catalog_tables, errors = Threads.gather(f"listing udfs in {catalog}", tasks) |
77 | 81 | if len(errors) > 0: |
78 | 82 | logger.error(f"Detected {len(errors)} while scanning udfs in {catalog}") |
|
0 commit comments