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

SubscriptionItem.schedule_id is None after creation in Tableau Cloud

Open kareltv opened this issue 6 months ago • 3 comments

Describe the bug When retrieving subscriptions using the TSC API on Tableau Online (Tableau Cloud), the SubscriptionItem.schedule_id field is always None, even for active subscriptions that were created with a valid schedule. This makes it impossible to update these subscriptions (e.g. suspend them), as the schedule ID is required for the update call.

Versions Tableau: Tableau Online (Cloud)

Python: Python 3.11.10

TSC library: 0.38

To Reproduce

import tableauserverclient as TSC

tableau_auth = TSC.PersonalAccessTokenAuth(
    token_name=TOKEN_NAME,
    personal_access_token=TOKEN_SECRET,
    site_id=SITE_ID
)
server = TSC.Server(SERVER_URL, use_server_version=True)

with server.auth.sign_in(tableau_auth):
    all_subscriptions, pagination_item = server.subscriptions.get()
    for subscription in all_subscriptions:
        print(
            f"Subscription ID: {subscription.id}, "
            f"Name: {subscription.subject}, "
            f"Suspended: {subscription.suspended}, "
            f"Schedule ID: {subscription.schedule_id}, "  # Always None
            f"User ID: {subscription.user_id}"
        )

Outputs:

Subscription ID: abc, Name: test test, suspended: False, Schedule ID: None, user ID: abc

Results Even though the subscription is active and was created using a valid schedule, the subscription.schedule_id is always None. This causes server.subscriptions.update(subscription) to fail with the following error:

404023: Resource Not Found
Schedule 'null' could not be found.

kareltv avatar Jun 25 '25 10:06 kareltv

The issue is that currently Tableau Online does not have ids for subscription schedule objects as you have noted, and the update request payload inside TSC is explicitly formatted for Tableau Server, not Online.

https://github.com/tableau/server-client-python/blob/28860189f440b180fed1488c9b93b51118b030ba/tableauserverclient/server/request_factory.py#L1259

This will require some testing of the various Intervals that Online can support. I also view it as related to #1592 since the payloads differ for Server and Cloud.

jorwoods avatar Jun 25 '25 12:06 jorwoods

So if I understand this correctly, the only way I could now call subscription.update() for subscription in Tableau Online without changing it's schedule is to keep track of the schedule interval name (for example in the subject of the subscription) and match it with the schedule.id from result of server.schedules.get() and use this schedule.id in the subscription.update()?

kareltv avatar Jun 25 '25 13:06 kareltv

No. Subscriptions are not tied to schedule "id"s on cloud the way they are on server. The schedule and its intervals are properties of the subscription instead of a separate element the subscription is linked to.

For now, it looks to me like the subscriptions.update method is non-functional for cloud until we can change how the request payload gets generated which may take some time to work through.

jorwoods avatar Jun 25 '25 13:06 jorwoods