server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Discrepancy in the number of views after workbook migration

Open Jessie-dd12345 opened this issue 1 year ago • 5 comments

I am migrating workbook A from Tableau Server to Tableau Cloud using Tableau Server Client API (version: 0.31). The views in workbook A show a discrepancy: there are only 11 views in the source (Tableau Server), but there are 12 views in the destination (Tableau Cloud), which shows 1 view was increased after migration. I coudn't figure it out and will be really appreciate if anyone could help me. Thank you so much!!

Jessie-dd12345 avatar Jul 01 '24 05:07 Jessie-dd12345

I suspect that one of the views was hidden on the original site, and when published to the new site, you didn't set the hidden_views attribute on the WorkbookItem.

jorwoods avatar Jul 02 '24 02:07 jorwoods

I suspect that one of the views was hidden on the original site, and when published to the new site, you didn't set the hidden_views attribute on the WorkbookItem.

Thank you so much for answering my question. Could you please tell me how to set hidden_views attribute on the WorkbookItem? It didn't work when I tried this:

   def _publish(self, dest_project_id, item_file_path):
        new_workbook = self.dest_server.workbooks.publish(
            TSC.WorkbookItem(dest_project_id), item_file_path, "Overwrite", hidden_views=True, skip_connection_check=True
        )
        logger.info(f"Uploaded workbook: workbook id: {new_workbook.id}, workbook name: {new_workbook.name}")

Or this:

def _publish(self, dest_project_id, item_file_path):
     new_workbook = self.dest_server.workbooks.publish(
         TSC.WorkbookItem(dest_project_id).hidden_views=True, item_file_path, "Overwrite", skip_connection_check=True
     )
     logger.info(f"Uploaded workbook: workbook id: {new_workbook.id}, workbook name: {new_workbook.name}")

Jessie-dd12345 avatar Jul 02 '24 03:07 Jessie-dd12345

TSC.WorkbookItem has a hidden_views attribute that should be a list[str]. The strings passed should be the names of the views you wish to hide.

Even though the current version of TSC has a hidden_views argument to server.workbooks.publish, that has been deprecated for a few years and looks like it'll be removed in the next release.

jorwoods avatar Jul 02 '24 03:07 jorwoods

Thank you so much!! That means I need to find out the list of hidden_views in the source server first, in order to hide them too in the destination server using hidden_views right? Or the hidden views will be showed in the destination server

Jessie-dd12345 avatar Jul 02 '24 04:07 Jessie-dd12345

Correct. I've used a metadata api query like this in the past to find hidden views:

query hiddenviews($wb_luid: String) {
  workbooks(filter:{luid:$wb_luid}){
    views(filter:{path:""}){
      view_name: name
    }
  }
}

jorwoods avatar Jul 02 '24 04:07 jorwoods