Is there a way to set session context to the SQL code generated by Looker?

Hi there,

I need to set session context  before the SQL code to be able to retrieve results from the DB.

sp_set_session_context N'AccountID', 1234;


SELECT TOP (500)
    account_v2.AccountId  AS [account_v2.account_id]
FROM 
    dbo.account  AS account_v2

How can I achieve this in Looker? 

So the session context must be set before the SQL code is run.

Can anyone help please?

Thanks

Ashwita

0 2 153
2 REPLIES 2

Also tried passing in the DB connection:

sp_set_session_context  @key = N'AccountID', @value = {{ _user_attributes['accountid'] }}

But I don’t get any results in the dashboard.

c22638da-ff3c-4d5d-97d4-42b58b3c2843.png

Looker support team has confirmed that there is no way to pass the session context variables from Looker. They have advised me to log a product request. Please give a thumbs up if you need this feature.

https://portal.feedback.us.pendo.io/app/#/case/200827?currentProductId=53ee6715-9dcb-471f-bd41-7846a...

Top Labels in this Space
Top Solution Authors