diff --git a/tableauserverclient/models/data_acceleration_report_item.py b/tableauserverclient/models/data_acceleration_report_item.py index 3a8883bed..3bc509a06 100644 --- a/tableauserverclient/models/data_acceleration_report_item.py +++ b/tableauserverclient/models/data_acceleration_report_item.py @@ -47,7 +47,7 @@ def __init__(self, comparison_records): self._comparison_records = comparison_records def __repr__(self): - return f"<(deprecated)DataAccelerationReportItem site={self.site} sheet={sheet_uri}>" + return f"<(deprecated)DataAccelerationReportItem records={len(self._comparison_records)}>" @property def comparison_records(self): diff --git a/tableauserverclient/server/endpoint/data_acceleration_report_endpoint.py b/tableauserverclient/server/endpoint/data_acceleration_report_endpoint.py index 579001156..96ced4ebf 100644 --- a/tableauserverclient/server/endpoint/data_acceleration_report_endpoint.py +++ b/tableauserverclient/server/endpoint/data_acceleration_report_endpoint.py @@ -1,4 +1,5 @@ import logging +import warnings from .default_permissions_endpoint import _DefaultPermissionsEndpoint from .endpoint import api, Endpoint @@ -21,6 +22,39 @@ def baseurl(self): @api(version="3.8") def get(self, req_options=None): + """ + Gets the data acceleration report for the current site, which compares + page load times for sheets before and after data acceleration. + + Deprecated: this method will be removed in a future release of this + library. Tableau retired data acceleration and its REST API methods + in Tableau Server 2026.2 (REST API 3.29). The method is not available + on Tableau Cloud. + + REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_site.htm#get_data_acceleration_report + + Parameters + ---------- + req_options : RequestOptions, optional + Options to pass to the request. + + Returns + ------- + DataAccelerationReportItem + The report, with one comparison record per accelerated sheet. + + Warnings + -------- + This method is deprecated. Tableau Cloud and Tableau Server 2026.2 and + later respond to this request with a 404 (error code 404003). + """ + warnings.warn( + "DataAccelerationReport.get is deprecated and will be removed. Tableau retired data acceleration " + "in Tableau Server 2026.2.", + DeprecationWarning, + # 3, not 2: the @api wrapper adds a frame, and the warning should point at the caller. + stacklevel=3, + ) logger.info("Querying data acceleration report") url = self.baseurl server_response = self.get_request(url, req_options) diff --git a/test/test_data_acceleration_report.py b/test/test_data_acceleration_report.py index c0589a84b..f4924ae9e 100644 --- a/test/test_data_acceleration_report.py +++ b/test/test_data_acceleration_report.py @@ -26,8 +26,10 @@ def test_get_data_acceleration_report(server): response_xml = GET_XML.read_text() with requests_mock.mock() as m: m.get(server.data_acceleration_report.baseurl, text=response_xml) - data_acceleration_report = server.data_acceleration_report.get() + with pytest.warns(DeprecationWarning, match="deprecated and will be removed") as record: + data_acceleration_report = server.data_acceleration_report.get() + assert record[0].filename == __file__ assert 2 == len(data_acceleration_report.comparison_records) assert "site-1" == data_acceleration_report.comparison_records[0].site @@ -43,3 +45,8 @@ def test_get_data_acceleration_report(server): assert "1.29" == data_acceleration_report.comparison_records[1].avg_non_accelerated_plt assert "3" == data_acceleration_report.comparison_records[1].accelerated_session_count assert "0.372" == data_acceleration_report.comparison_records[1].avg_accelerated_plt + + +def test_data_acceleration_report_item_repr(): + item = TSC.models.DataAccelerationReportItem([]) + assert "records=0" in repr(item)