Skip to content

Field parameter is order specific #1620

@jorwoods

Description

@jorwoods

Describe the bug
When querying Tableau Server or online and specifying the return fields, the value of _default_ must be first if present, otherwise a Bad Request error is thrown. Query string keys and values should not be order specific.

I believe this to be a server side bug, but intend to investigate compensating for it within TSC.

Versions
Details of your environment, including:

  • Tableau Server version (or note if using Tableau Online): Tableau Online
  • Python version: 3.12
  • TSC library version: 0.38

To Reproduce
Steps to reproduce the behavior. Please include a code snippet where possible.

The below will produce the error most of the time. sets in python are not ordered containers, and as such where the _default_ value appears in the value list is non-deterministic.

import os

from dotenv import load_dotenv
import tableauserverclient as TSC

load_dotenv()

server = TSC.Server(os.environ["TABLEAU_SERVER"], use_server_version=True)
auth = TSC.PersonalAccessTokenAuth(os.environ["TOKEN_NAME"], os.environ["TOKEN_SECRET"], site_id=os.environ["TABLEAU_SITE"])
print(auth)

with server.auth.sign_in(auth):
    workbooks = server.workbooks.fields(TSC.RequestOptions.SelectFields.Owner.Email)
    print(list(workbooks))

Results
What are the results or error messages received?

    raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace, url)
tableauserverclient.server.endpoint.exceptions.ServerResponseError:

        409004: Bad Request
                Invalid Parameter. (0xB4EAB088 : Invalid field names '[_default_]' for Workbook. Valid field names are: [ContentUrl, Description, Size, DefaultViewId, CreatedAt, HasExtracts, UpdatedAt, Name, SheetCount, ShowTabs, ShareDescription, Id, LastPublishedAt, Tags, PrimaryContentUrl].)

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

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