fix: save columns reference from sqllab save datasets flow (#24248)

This commit is contained in:
Hugh A. Miles II
2023-06-20 13:54:19 -04:00
committed by GitHub
parent fdef9cbc96
commit 93e1db4bd9
37 changed files with 489 additions and 202 deletions

View File

@@ -46,6 +46,7 @@ from superset.exceptions import SupersetException
from superset.extensions import cache_manager
from superset.models.sql_lab import Query
from superset.sql_parse import ParsedQuery, Table
from superset.superset_typing import ResultSetColumnType
if TYPE_CHECKING:
# prevent circular imports
@@ -407,8 +408,8 @@ class HiveEngineSpec(PrestoEngineSpec):
@classmethod
def get_columns(
cls, inspector: Inspector, table_name: str, schema: str | None
) -> list[dict[str, Any]]:
return inspector.get_columns(table_name, schema)
) -> list[ResultSetColumnType]:
return BaseEngineSpec.get_columns(inspector, table_name, schema)
@classmethod
def where_latest_partition( # pylint: disable=too-many-arguments
@@ -417,7 +418,7 @@ class HiveEngineSpec(PrestoEngineSpec):
schema: str | None,
database: Database,
query: Select,
columns: list[dict[str, Any]] | None = None,
columns: list[ResultSetColumnType] | None = None,
) -> Select | None:
try:
col_names, values = cls.latest_partition(
@@ -436,7 +437,7 @@ class HiveEngineSpec(PrestoEngineSpec):
return None
@classmethod
def _get_fields(cls, cols: list[dict[str, Any]]) -> list[ColumnClause]:
def _get_fields(cls, cols: list[ResultSetColumnType]) -> list[ColumnClause]:
return BaseEngineSpec._get_fields(cols) # pylint: disable=protected-access
@classmethod
@@ -481,7 +482,7 @@ class HiveEngineSpec(PrestoEngineSpec):
show_cols: bool = False,
indent: bool = True,
latest_partition: bool = True,
cols: list[dict[str, Any]] | None = None,
cols: list[ResultSetColumnType] | None = None,
) -> str:
return super( # pylint: disable=bad-super-call
PrestoEngineSpec, cls