fix: handle empty catalog when DB supports them (#29840)

This commit is contained in:
Beto Dealmeida
2024-08-13 10:08:43 -04:00
committed by GitHub
parent 9f5eb899e8
commit 39209c2b40
23 changed files with 100 additions and 148 deletions

View File

@@ -25,6 +25,7 @@ from superset.db_engine_specs import load_engine_specs
from superset.db_engine_specs.postgres import PostgresEngineSpec
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.models.sql_lab import Query
from superset.utils.core import backend
from superset.utils.database import get_example_database
from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec
from tests.integration_tests.fixtures.certificates import ssl_certificate
@@ -525,11 +526,10 @@ def test_get_catalog_names(app_context: AppContext) -> None:
"""
Test the ``get_catalog_names`` method.
"""
database = get_example_database()
if database.backend != "postgresql":
if backend() != "postgresql":
return
database = get_example_database()
with database.get_inspector() as inspector:
assert PostgresEngineSpec.get_catalog_names(database, inspector) == {
"postgres",