I would like to be able to use the API to run a look under a specific users account in development mode for that user. Is that possible?
I found that I can login as a specific user under api auth (login_user). But would that user need to currently be in development mode in order to use the development version of the models? Or is there a way to force development mode to be used?
Reason for this request is to allow automation of testing development models.
Looker folks: any update here? Can we execute looks as another user’s dev mode via the API? Can we switch to a particular user’s branch via the API and then execute looks? We’re looking for a way to set up some automated result-set testing as a post-commit hook.
Yes we added python scripts to our branch to automate running looks and comparing results. The script uses the branch meta data to determine a user login (if not master branch of course). It pulls the look results for each test look using 2 different logins and compares results, asserting for matches in number of columns and value matches. Test scripts are run from Jenkins or Travis build script.
We still rely on the user login being in dev mode, I have not heard of looker implementing the feature to change to dev mode or use dev mode from an api command.
Hope that helps.
I’d love to know a bit more if you’re willing to share. I imagine that you have a post-commit hook whenever there’s a PR in Github, and that with the payload you parse the branch. Then you call
all_git_branches(...)against the Looker API, obtaining the user name associated with the aforementioned branch. Then you fire up another API session as that user, and run a suite of Looks (presumably in their dev mode). Does that sound about right? If so, I’m finding that the response to
owner_namepopulated. So…I’m sort of stuck.
A bit hacky maybe, but we’re using naming convention of the looker dev branch to pull first and last name of user and then look up the looker user with that name. We get current branch name from an environment variable, both jenkins and travis already had that set for us.
The default workspace for API sessions is the “production” workspace.
To change session to dev mode using an api command you can run the api_session end point passing in dev, instead of production.
If your Looker API client application needs to work in a dev workspace across multiple
API sessions, be sure to select the dev workspace after each login.