Bulk Schedule Management in Looker with Python SDK

Eric Arsenault
2 min readMar 25, 2021

--

One problem I have ran into while supporting large groups of Looker users is the need to programmatically schedule reports in bulk, many times with unique filter values. After looking for tools with this functionality I discovered the looker-sdk, and here is what I have come up with. If you are unfamiliar with this SDK or how to set it up, see the below link.

First we will need to open a .py file, import all the necessary packages and initiate the API.

Next we will need to pull our filter values for provisioning our schedules. For this task we will use the create_sql_query and run_sql_query functions of the Looker API. These are extremely powerful; together they give you the ability to query all of your database connections and LookML models from one unified API with a single set of credentials, directly in Python! Here we pull a query from the API as json and pass to a Pandas DataFrame. For the sake of this example I will be using fake data.

Now we will loop through these rows and create a new schedule for each user. For this example each schedule will have its own distinct title, filter value and recipient. They will be scheduled to send every morning at 5am as a .csv file. This logic could be used for many use cases, but this is one that I have found to be common and demonstrates the functionality well.

Great, now that we have created the schedules, we can check the UI to see that everything went as planned.

Looks like everything went well, we now have 10 new distinct schedules in Looker. The full code is on my Github here.

--

--