[LookerSDK] create_scheduled_plan: Models40 is not defined

Hi,

I’m having an issue in running this create_scheduled_plan. I am trying to basically have a CSV sheet read in with a list of schedules, and run a script that iterates over each row, and creates a schedule for each row based on the defined specifications (in each column).

I have all the IDs as variables and it seems like it pulls everything correctly.

However, when I get to this part of the code, based on the example given and another Looker community question, I keep getting an error.

schedule = sdk.create_scheduled_plan(body=models40.WriteScheduledPlan(name=schedule_title, dashboard_id=dashboard_id, look_id=look_id, user_id=user_id, filters_string=filter_string,run_as_recipient= True, datagroup=datagroup, scheduled_plan_destination = [models40.ScheduledPlanDestination(format=format, apply_formatting=True, apply_vis=True, address=email,  type="email", message=message)]))

The error I receive is:

NameError: name 'models40' is not defined

And it’s directly copied from the example linked also above. Any help appreciated! Thank you very much!

0 4 383
4 REPLIES 4

Can you try updating the import to remove 40 and then just reference models?

@Eric_Lyons - Thanks for your response! When I remove the 40, it comes with the same error: 

NameError: name 'models' is not defined

I’ve labeled sdk as the below, so not quite sure if this is the issue.

sdk = looker_sdk.init40(config_file='looker.ini', section='Looker')

Any thoughts? Thank you so much!

Hey @stumpstumpstump,

Can you run pip install looker_sdk --upgrade?

I have seen a few colleagues run into this recently with older versions of the sdk. 

Thanks,

Eric

@Eric_Lyons - Oh, that ended up working out! I would of never guessed! Thank you. 

Now, I’m still running into an error - I’m trying to use the filter_string parameter, but I have no idea how to retrieve this from a specific look and dashboard. Do you, by chance, know where I can find this? Thank you 🙂