Skip to content

Schedules cannot handle valid monthly schedules #1358

Closed

Description

@jacalata

The schedules code only allows the string "LastDay". (https://github.com/tableau/server-client-python/blob/b06a7a249f7b0123f8b99fc43bd45539ad5f9eec/tableauserverclient/models/interval_item.py#L249C3-L253C33)

It should also allow the strings "First", "Second"..."Fifth".
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_extract_and_encryption.htm#create_cloud_extract_refresh_task

While fixing this code, it would be ideal to reduce the duplication of elements e.g the array of valid hourly values is defined twice in the file.

Activity

  1. bcantoni commented on May 4, 2024

    @bcantoni
    Contributor

    Another example of this is reported in #1369 which I closed as a duplicate.

  2. bcantoni commented on Sep 10, 2024

    @bcantoni
    Contributor

    We're investigating a fix here (internal issue 16715720).

  3. added a commit that references this issue on Sep 13, 2024
    9c6cc8f
  4. bcantoni commented on Sep 13, 2024

    @bcantoni
    Contributor

    Here are steps to reproduce the issue on Tableau Server.

    1. Login to Tableau Server and head to the Schedules settings page. (You'll need to be a server admin to edit these.)
    2. Create a new schedule, type Extract Refresh, under Frequency select Monthly, then under On change it to any value other than the default Day, then save the schedule
    image
    1. Run the script below (substituting your own values for the PAT, site and server) which will loop over all schedules and call get_by_id() on each one. This should trigger the ValueError exception.
    import tableauserverclient as TSC
    
    
    tableau_auth = TSC.PersonalAccessTokenAuth(
        'PAT-NAME',
        'PAT-VALUE',
        'SITE-NAME-OR-BLANK'
        )
    server = TSC.Server('SERVER-URL', use_server_version=True)
    server.auth.sign_in(tableau_auth)
    
    all_sch, pagination = server.schedules.get()
    for sch in all_sch:
        sc = server.schedules.get_by_id(sch.id)
        print(sc.id)

    You should get the error with exceptions like the following:

    Traceback (most recent call last):
      File "/Users/brian/.pyenv/versions/tools-3.12/lib/python3.12/site-packages/tableauserverclient/models/interval_item.py", line 259, in interval
        if not (1 <= int(interval_value) <= 31):
                     ^^^^^^^^^^^^^^^^^^^
    ValueError: invalid literal for int() with base 10: 'Monday'
    
    ValueError: Invalid interval value for a monthly frequency: Monday.
    
  5. added a commit that references this issue on Sep 17, 2024
    52c1541
  6. added a commit that references this issue on Sep 17, 2024
    28c2487
  7. bcantoni commented on Sep 17, 2024

    @bcantoni
    Contributor

    This is fixed in the development branch now and will be available in the next release (0.33). If anyone would like to test it before release, they can follow the steps here: https://tableau.github.io/server-client-python/docs/#install-from-the-development-branch

  8. added a commit that references this issue on May 5, 2026
    d02d0c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions