How to define environment variable in Looker

I have looker project which needs to be deployed in Dev, QA & Prod. I need to define environment specific constants. when code runs in dev it should check for date < 7. After the code deployed in QA, when the code runs in QA it should check for the date < 15. Same with Prod.

My question after the deployment I should not change the code but it should pick up these from environment variable. Can we use Manifest / User Attributes?

One more: Is there any way to know which environment the code runs currently?

1 6 1,543
6 REPLIES 6

You can use manifest file for this 

 

 

how did you manage to do so?

Hi,

In manifest.lkml you can add constant values, as shown:

constant: name{
value: "3.28084"
}

 

https://cloud.google.com/looker/docs/reference/param-manifest-constant

 

and can I set this constant based on the branch (main, or "development Mode"? Or can I fetch it from Github Env Variable?

You can edit the manifest.lkml file and include the constants you need in development mode on the branch.

sorry, let me rephrase: I want to have a variable, which points to different values, depending if i am in production mode or development mode. My use case is: I want to point to a test dataset if I am on any branch which is not main (or simply in development mode), and use the production dataset if I am on main (or simply in production mode). Is this possible and if so, do you have a code snippet?

Top Labels in this Space