Skip to content

Issue with Downloading Large Views from Tableau Server to CSV #1374

Open
@abhishek7575-spec

Description

@abhishek7575-spec

Describe the bug
I'm encountering an issue when trying to download a view that is around 200 MB in size. My script works perfectly for smaller files (5 MB or 10 MB), but it keeps running indefinitely and doesn't write data into the CSV file for the larger view.

The script successfully logs "CSV populated," indicating that server.views.populate_csv completes, but the file is not written for larger views.

Here's the code I'm using:

def download_file(client, server, content_url, output_file, region):

    # NOTE: Monkey patched TSC.RequestOptions.Field class

    # since the contentUrl filter parameter was not supported

    setattr(TSC.RequestOptions.Field, 'ContentURL', 'contentUrl')

    req_option = TSC.RequestOptions()

    req_option.filter.add(TSC.Filter(TSC.RequestOptions.Field.ContentURL,

                     TSC.RequestOptions.Operator.Equals,

                     content_url))

    logger.info('Fetching views...')

    views, pagination_item = server.views.get(req_option)

    logger.info(f'Views fetched: {len(views)}')

    if len(views) == 1:

      only_matched_index = 0

      view = views[only_matched_index]

      logger.info('Populating CSV...')

      server.views.populate_csv(view, TSC.CSVRequestOptions(maxage = 5))

      logger.info('CSV populated.')

      with open(output_file, 'wb') as f:

        f.write(b''.join(view.csv))

      logger.info(f"CSV DATA WRITTEN TO the {output_file}")

 

OUTPUT:

INFO:main:Fetching views...

INFO:main:Views fetched: 1

INFO:main:Populating CSV...

INFO:main:CSV populated.

Could anyone suggest what might be going wrong with handling larger views? Are there any additional steps or considerations when dealing with larger files in Tableau Server that I might be missing?

Any insights or suggestions would be greatly appreciated!

Thank you!

Versions
Details of your environment, including:

  • Python version:3.9
  • TSC library version:0.30

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedA user needs help, may be a mistake, a bug or a feature requestneeds investigationIssue needs to be looked at by Tableau

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions