Skip to content

Subscription creation without pre-existing schedule item fails (user error?) #1543

Description

@CodingOnWindowsOS

Describe the bug
I am attempting to create a subscription to a workbook using a schedule that doesn't exist at creation time. To perform the same action using Tableau Cloud/Server front-end, the user would configure the subscription by specifying the target type (view or entire workbook), format, subject, and schedule.

Versions
Tableau Cloud
Python 3.12.3
TSC library version 3.24

To Reproduce

 # Sign-in to server.
  with server.auth.sign_in(tableau_auth):
      # Ensure the most recent Tableau REST API version is used.
      server.use_highest_version()
      # Retrieve the user requiring the new subscription.
      user = server.users.filter(name='cmp160130@gmail.com')
      # Retreive the subscription's content (e.g., workbook, view)
      target = server.workbooks.filter(name='North America Sales')

      new_subscription = tsc.SubscriptionItem(
          subject='North America Sales (demo)',
          schedule_id=tsc.ScheduleItem(
              name=None,
              priority=None,
              schedule_type=None,
              execution_order=None,
              interval_item=tsc.DailyInterval(time(0),
                  24.0, 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
              )
          ),
          user_id=user[0].id,
          target=tsc.Target(target[0].id, target_type='Workbook')
      )

      # Subscribe the user to the target content.
      server.subscriptions.create(subscription_item=new_subscription)

Results
What are the results or error messages received?
TypeError: cannot serialize <Schedule#None "None" <DailyInterval start=00:00:00 interval=(24.0, 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')>> { _created_at: None, _end_schedule_at: None, _id: None, _next_run_at: None, _state: None, _updated_at: None, interval_item: <DailyInterval start=00:00:00 interval=(24.0, 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')>, _execution_order: None, _name: None, _priority: None, _schedule_type: None} (type ScheduleItem)

If I swap out the subscription item configuration above for the following that uses a pre-existing schedule, then it works fine.

new_subscription = tsc.SubscriptionItem(
    subject='North America Sales (demo)',
    schedule_id='f3dcaf7a-9668-4eb2-8c20-2f7c21e82744',
    user_id=user[0].id,
    target=tsc.Target(target[0].id, target_type='Workbook')
)

Activity

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

    help wantedA user needs help, may be a mistake, a bug or a feature requeststale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions