Skip to content

Commit

Permalink
Use dedicated advice code for unsupported sql (#2018)
Browse files Browse the repository at this point in the history
## Changes
use dedicated advice code for unsupported sql

### Linked issues
None

### Functionality 
None

### Tests
Not tested

---------

Co-authored-by: Eric Vergnaud <[email protected]>
  • Loading branch information
ericvergnaud and ericvergnaud authored Jul 2, 2024
1 parent b11ac05 commit 78e5d1d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/databricks/labs/ucx/source_code/linters/dbfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/ucx/source_code/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/source_code/linters/test_dbfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 78e5d1d

Please sign in to comment.