1 Reply Latest reply on Jan 17, 2020 4:22 PM by Santiago Sanchez

    Incomplete "IntervalItem" implementation in Python Tableau Server Client?

    egg.shen

      I might be missing something, but the IntervalItem implementation of the Python Tableau Server Client seems to not have a working "start_time=time(hour, minute) and end_time=time(hour, minute)" implementation.

       

      Basically, creating an IntervalItem with the method described in the documentation doesn't work.

       

      Is there an obvious thing that I'm missing, or is this a known issue? I'll just go ahead and roll my own if it's not yet implemented.

        • 1. Re: Incomplete "IntervalItem" implementation in Python Tableau Server Client?
          Santiago Sanchez

          Hey! This worked for me:

           

          import tableauserverclient as TSC

          import datetime

           

          tableau_auth = TSC.TableauAuth(username, password, site)            # Provide: username of site/server admin, password, site name

          server = TSC.Server('https://server.tableau.com')                           # Provide the Tableau Server URL

           

          ##### STEP 1: Sign In to Tableau Server #####

          with server.auth.sign_in(tableau_auth):

           

           

          ##### STEP 2: Define and Create the schedule #####

          # Create an interval to run every 2 hours between 2:30AM and 11:00PM

              hourly_interval = TSC.HourlyInterval(start_time=datetime.time(2, 30, 0), end_time=datetime.time(23, 0, 0), interval_value=2)

           

          # Create schedule item

              hourly_schedule = TSC.ScheduleItem("Hourly-Schedule-TSC", 50, TSC.ScheduleItem.Type.Extract, TSC.ScheduleItem.ExecutionOrder.Parallel, hourly_interval)

           

          # Create schedule

              hourly_schedule = server.schedules.create(hourly_schedule)

           

          I got the example from the docs (API reference) but it didn't work for me at first either... I was missing the datetime module

           

          Hope this helps!

          Santiago