mirror of
https://github.com/apache/superset.git
synced 2024-09-06 22:07:34 -04:00
fix: move columns to datasource object for bootstrap data (#20203)
* move columns to datasource * address concerns
This commit is contained in:
parent
e07ee6c764
commit
9432c62ec1
@ -166,6 +166,10 @@ class Query(Model, ExtraJSONMixin):
|
||||
def sql_tables(self) -> List[Table]:
|
||||
return list(ParsedQuery(self.sql).tables)
|
||||
|
||||
@property
|
||||
def columns(self) -> List[Table]:
|
||||
return self.extra.get("columns", [])
|
||||
|
||||
def raise_for_access(self) -> None:
|
||||
"""
|
||||
Raise an exception if the user cannot access the resource.
|
||||
|
@ -889,11 +889,10 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||
except (SupersetException, SQLAlchemyError):
|
||||
datasource_data = dummy_datasource_data
|
||||
|
||||
columns: List[Dict[str, Any]] = []
|
||||
if datasource:
|
||||
datasource_data["owners"] = datasource.owners_data
|
||||
if isinstance(datasource, Query):
|
||||
columns = datasource.extra.get("columns", [])
|
||||
datasource_data["columns"] = datasource.columns
|
||||
|
||||
bootstrap_data = {
|
||||
"can_add": slice_add_perm,
|
||||
@ -908,7 +907,6 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
|
||||
"user": bootstrap_user_data(g.user, include_perms=True),
|
||||
"forced_height": request.args.get("height"),
|
||||
"common": common_bootstrap_payload(),
|
||||
"columns": columns,
|
||||
}
|
||||
if slc:
|
||||
title = slc.slice_name
|
||||
|
Loading…
Reference in New Issue
Block a user