mirror of
https://github.com/apache/superset.git
synced 2026-04-17 15:15:20 +00:00
feat(DB engine spec): get_catalog_names (#23447)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
from textwrap import dedent
|
||||
from unittest import mock
|
||||
|
||||
from flask.ctx import AppContext
|
||||
from sqlalchemy import column, literal_column
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
@@ -24,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.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
|
||||
from tests.integration_tests.fixtures.database import default_db_extra
|
||||
@@ -514,3 +516,19 @@ def test_base_parameters_mixin():
|
||||
},
|
||||
"required": ["database", "host", "port", "username"],
|
||||
}
|
||||
|
||||
|
||||
def test_get_catalog_names(app_context: AppContext) -> None:
|
||||
"""
|
||||
Test the ``get_catalog_names`` method.
|
||||
"""
|
||||
database = get_example_database()
|
||||
|
||||
if database.backend != "postgresql":
|
||||
return
|
||||
|
||||
with database.get_inspector_with_context() as inspector:
|
||||
assert PostgresEngineSpec.get_catalog_names(database, inspector) == [
|
||||
"postgres",
|
||||
"superset",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user