mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore(sqllab): Cleanup /tables/... endpoint (#21284)
This commit is contained in:
@@ -917,48 +917,6 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
|
||||
"""
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_all_datasource_names(
|
||||
cls, database: "Database", datasource_type: str
|
||||
) -> List[utils.DatasourceName]:
|
||||
"""Returns a list of all tables or views in database.
|
||||
|
||||
:param database: Database instance
|
||||
:param datasource_type: Datasource_type can be 'table' or 'view'
|
||||
:return: List of all datasources in database or schema
|
||||
"""
|
||||
# TODO: Fix circular import caused by importing Database
|
||||
schemas = database.get_all_schema_names(
|
||||
cache=database.schema_cache_enabled,
|
||||
cache_timeout=database.schema_cache_timeout,
|
||||
force=True,
|
||||
)
|
||||
all_datasources: List[utils.DatasourceName] = []
|
||||
for schema in schemas:
|
||||
if datasource_type == "table":
|
||||
all_datasources.extend(
|
||||
utils.DatasourceName(*datasource_name)
|
||||
for datasource_name in database.get_all_table_names_in_schema(
|
||||
schema=schema,
|
||||
force=True,
|
||||
cache=database.table_cache_enabled,
|
||||
cache_timeout=database.table_cache_timeout,
|
||||
)
|
||||
)
|
||||
elif datasource_type == "view":
|
||||
all_datasources.extend(
|
||||
utils.DatasourceName(*datasource_name)
|
||||
for datasource_name in database.get_all_view_names_in_schema(
|
||||
schema=schema,
|
||||
force=True,
|
||||
cache=database.table_cache_enabled,
|
||||
cache_timeout=database.table_cache_timeout,
|
||||
)
|
||||
)
|
||||
else:
|
||||
raise Exception(f"Unsupported datasource_type: {datasource_type}")
|
||||
return all_datasources
|
||||
|
||||
@classmethod
|
||||
def handle_cursor(cls, cursor: Any, query: "Query", session: Session) -> None:
|
||||
"""Handle a live cursor between the execute and fetchall calls
|
||||
|
||||
Reference in New Issue
Block a user