View the original community article here
Last tested: Mar 16, 2018
By default, API calls run in production mode. That means Looker will load all projects and LookML models from the production directory on the Looker instance. You can change the workspace of the API session to "dev" in order to run queries against models residing in the dev mode subdirectory of the user calling the API.
To do this with the SDK:
sdk.update_session() to switch between production and dev modes:
To switch into production mode:
To switch into dev mode:
To switch to a specific git branch, use this endpoint
new API access_tokens always start in "production" mode
Tech note 1: The association with production mode or dev mode is tied to the access_token. Every time a client app calls
login() to get a new access_token, the new access_token will always be bound to production mode. The client app must always call
update_session() on a new access_token to switch it to dev mode, if desired.
Interactive User dev mode "stickiness"
Tech note 2: The dev mode / production mode state of an access_token is independent of all other access_tokens, and independent of the dev mode / production mode state of the interactive user logged into the Looker UI. This is so that 2 client applications can call the Looker API at the same time, using the same user account, without affecting each other's dev or prod state. This is also so that client apps using a user account to login the the Looker API will not affect nor be affected by changes in the interactive user's dev mode state. The only requirement to achieve this independence is that each process acquire its own access_token via
For the interactive user, dev mode state is "sticky" and applies to all browser sessions that logged-in user has open, and that dev mode "stickiness" transcends login sessions. If the user is in dev mode in Looker UI and logs out and closes a Looker browser window, then logs into Looker again from the same browser, different browser, or different machine, the "dev mode" state from their previous login session will still be in effect. This "stickiness" applies only to the interactive logged in user. API access_tokens created for that same user account will not reflect or track with the user's interactive "dev mode" state in the Looker UI.
Features hard-coded to production models
A few Looker feature areas are hard-coded to always use production models, regardless of whether the current user or access_token dev/production mode:
- Rendered content
PDF, PNG, and JPG images of Looker dashboards or other content always runs against production models (if you'd like to be able to render content as it appears in your dev mode, +1 this feature request).
- SSO Embed sessions