Skip to content

Download datasource and workbook discrepancy #373

@zkrzyzanowski

Description

@zkrzyzanowski

I'm trying to download a copy of all published workbooks and datasources from our Tableau server and am getting some discrepancies on the number of files being downloaded. The GUI and python script show 75 and 117 files for datasources and workbooks respectively, but I only get 74 and 95 files for each downloaded.

import tableauserverclient as TSC
import os
from tableaudocumentapi import Datasource
from dotenv import load_dotenv
from pathlib import Path  # python3 only
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path)
import logging

logging.basicConfig(filename='file.log', filemode='w', level=logging.DEBUG)

# create an auth object
username = os.getenv('USERNAME')
password = os.getenv('PASSWORD')
server_url = os.getenv('SERVER_URL')
db_name = os.getenv('DATABASE_NAME')
extract_download_path = 'extracts'
workbook_download_path = 'workbooks'
tableau_auth = TSC.TableauAuth(username, password)

# create an instance for your server
server = TSC.Server(server_url)

# authenticate to Tableau
with server.auth.sign_in(tableau_auth):
    
    # get all postgres datasources
    all_datasources, pagination_item = server.datasources.get()
    datasource_ids = [datasource.id for datasource in all_datasources]
    print("\nThere are {} datasources on site ".format(len(all_datasources)))
    
    # download all datasources without extracts
    for id in datasource_ids:
      file_path = server.datasources.download(id, extract_download_path, False)

    all_workbooks, pagination_item = server.workbooks.get()
    workbook_ids = [workbook.id for workbook in all_workbooks]
    print("\nThere are {} workbooks on site".format(pagination_item.total_available))
    
    # download all datasources without extracts
    for id in workbook_ids:
      file_path = server.workbooks.download(id, workbook_download_path, False)


server.auth.sign_out()

My script above returns the correct #'s for each source and I get 75 values for file_path in datasource_ids, but only 74 download. For workbook_ids I get 100 values returned for file_path but only 95 actually download.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions