File tree 1 file changed +18
-2
lines changed
gooddata-sdk/gooddata_sdk
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -746,6 +746,19 @@ def get_exec_for_non_pivot(visualization: Visualization) -> ExecutionDefinition:
746
746
)
747
747
748
748
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
+
749
762
class TableService :
750
763
"""
751
764
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:
760
773
self ._compute = ComputeService (api_client )
761
774
762
775
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
764
780
exec_def = (
765
781
_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 )
767
783
else get_exec_for_non_pivot (visualization )
768
784
)
769
785
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