File tree Expand file tree Collapse file tree
gooddata-sdk/gooddata_sdk Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -746,6 +746,19 @@ def get_exec_for_non_pivot(visualization: Visualization) -> ExecutionDefinition:
746746 )
747747
748748
749+ def _vis_is_table (visualization : Visualization ) -> bool :
750+ attributes = visualization ._vo .get ("attributes" )
751+ if not attributes :
752+ return False
753+ content = attributes .get ("content" )
754+ if not content :
755+ return False
756+ vis_url = content .get ("visualizationUrl" )
757+ if not vis_url :
758+ return False
759+ return vis_url .split (":" )[- 1 ] == "table"
760+
761+
749762class TableService :
750763 """
751764 The TableService provides a convenient way to drive computations and access the results in a tabular fashion.
@@ -760,10 +773,13 @@ def __init__(self, api_client: GoodDataApiClient) -> None:
760773 self ._compute = ComputeService (api_client )
761774
762775 def for_visualization (self , workspace_id : str , visualization : Visualization ) -> ExecutionTable :
763- # Assume the received visualization is a pivot table if it contains row ("attribute") bucket
776+ # Assume the received visualization is a pivot table if:
777+ # - we can parse out "table" suffix from the attributes.contents.visualizationUrl
778+ # or
779+ # - it contains row ("attribute") bucket
764780 exec_def = (
765781 _get_exec_for_pivot (visualization )
766- if visualization .has_bucket_of_type (BucketType .ROWS )
782+ if _vis_is_table ( visualization ) or visualization .has_bucket_of_type (BucketType .ROWS )
767783 else get_exec_for_non_pivot (visualization )
768784 )
769785 response = self ._compute .for_exec_def (workspace_id = workspace_id , exec_def = exec_def )
You can’t perform that action at this time.
0 commit comments