fix: Trino - handle table not found in SQLLab (#26355)

Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com>
This commit is contained in:
Igor Khrol
2024-01-11 02:37:18 +02:00
committed by GitHub
parent b2a21f7166
commit 3daa038f5f
2 changed files with 41 additions and 0 deletions

View File

@@ -517,3 +517,19 @@ def test_get_columns_expand_rows(mocker: MockerFixture):
]
_assert_columns_equal(actual, expected)
def test_get_indexes_no_table():
from sqlalchemy.exc import NoSuchTableError
from superset.db_engine_specs.trino import TrinoEngineSpec
db_mock = Mock()
inspector_mock = Mock()
inspector_mock.get_indexes = Mock(
side_effect=NoSuchTableError("The specified table does not exist.")
)
result = TrinoEngineSpec.get_indexes(
db_mock, inspector_mock, "test_table", "test_schema"
)
assert result == []