From 78e5d1d92f76511cc9032b5a46de4ebce6701627 Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Tue, 2 Jul 2024 19:53:25 +0200 Subject: [PATCH] Use dedicated advice code for unsupported sql (#2018) ## Changes use dedicated advice code for unsupported sql ### Linked issues None ### Functionality None ### Tests Not tested --------- Co-authored-by: Eric Vergnaud --- src/databricks/labs/ucx/source_code/linters/dbfs.py | 2 +- src/databricks/labs/ucx/source_code/queries.py | 2 +- tests/unit/source_code/linters/test_dbfs.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/databricks/labs/ucx/source_code/linters/dbfs.py b/src/databricks/labs/ucx/source_code/linters/dbfs.py index c92fff5d33..b33c25698a 100644 --- a/src/databricks/labs/ucx/source_code/linters/dbfs.py +++ b/src/databricks/labs/ucx/source_code/linters/dbfs.py @@ -104,7 +104,7 @@ def lint(self, code: str) -> Iterable[Advice]: except SqlParseError as e: logger.debug(f"Failed to parse SQL: {code}", exc_info=e) yield Failure( - code='dbfs-query', + code='dbfs-query-unsupported-sql', message=f"SQL query is not supported yet: {code}", # SQLGlot does not propagate tokens yet. See https://github.com/tobymao/sqlglot/issues/3159 start_line=0, diff --git a/src/databricks/labs/ucx/source_code/queries.py b/src/databricks/labs/ucx/source_code/queries.py index 51786afbac..621d620936 100644 --- a/src/databricks/labs/ucx/source_code/queries.py +++ b/src/databricks/labs/ucx/source_code/queries.py @@ -52,7 +52,7 @@ def lint(self, code: str) -> Iterable[Advice]: except SqlParseError as e: logger.debug(f"Failed to parse SQL: {code}", exc_info=e) yield Failure( - code='table-migrate', + code='sql-query-unsupported-sql', message=f"SQL query is not supported yet: {code}", # SQLGlot does not propagate tokens yet. See https://github.com/tobymao/sqlglot/issues/3159 start_line=0, diff --git a/tests/unit/source_code/linters/test_dbfs.py b/tests/unit/source_code/linters/test_dbfs.py index 54721dca7f..1e67d63cb2 100644 --- a/tests/unit/source_code/linters/test_dbfs.py +++ b/tests/unit/source_code/linters/test_dbfs.py @@ -115,7 +115,7 @@ def test_dbfs_queries_failure(query: str): actual = list(ftf.lint(query)) assert actual == [ Failure( - code='dbfs-query', + code='dbfs-query-unsupported-sql', message=f'SQL query is not supported yet: {query}', start_line=0, start_col=0,