mass delete schedule

I have a lot of email schedules that need to be cleaned up and going one by one is not going to work.

I have two python scripts (one to get the list of schedule id, and the other to delete said list), but I'm not that great at python. if I wanted to delete all schedule queries related to user 44, how would I do that? right now, nothing comes back and yes, the looker.ini is set up correctly as I'm able to set up schedules through python. 

#get list of Schedule

import looker_sdk
sdk = looker_sdk.init40("../looker.ini")
 
def find_schedules(user_id: int) :
     
  """ Return all schedules of a particular user id
  Args:    user_id (int)
  Returns: all schedules of a particular user: result = {'name_of_schedule_plan': id_of_schedule_plan}
  Raises:  N/A (does not explicitly raise an exception)
  """
  result = {}
  schedule_plans = sdk.all_scheduled_plans(user_id=user_id)
  for i in schedule_plans:
    result[i['name']] = i['id']
  return result
 
#Delete script 
import looker_sdk
sdk = looker_sdk.init40("../looker.ini")

def find_schedules(user_id: int) :
     
  """ Return all schedules of a particular user id
  Args:    user_id (int)
  Returns: all schedules of a particular user: result = {'name_of_schedule_plan': id_of_schedule_plan}
  Raises:  N/A (does not explicitly raise an exception)
  """
  result = {}
  schedule_plans = sdk.all_scheduled_plans(user_id=user_id)
  for i in schedule_plans:
    result[i['name']] = i['id']
  return result


Solved Solved
0 1 51
1 ACCEPTED SOLUTION

Hi there,

Thanks for posting your question! There is a post created by one of our staff that provides a sample script that might be helpful - Bulk update or reassign schedules.

 

View solution in original post

1 REPLY 1

Hi there,

Thanks for posting your question! There is a post created by one of our staff that provides a sample script that might be helpful - Bulk update or reassign schedules.