Dynamically adjusting connection based on user attributes

Hi!  I'm working on a project to move our looker workloads from SQL Server to Snowflake.  I'd like to be able to use our existing model file but dynamically change the connection between SQL/Snowflake based on user attributes that I set.  I want to do this because it means I can gradually shift users to the new backend (and I can avoid doing a hard cutover).

How can I accomplish this?  I've tried:

1. Using Liquid to alter the connection of the model, e.g.:

 

{% if _user_attributes['use_snowflake'] %}
connection: "snowflake"
{% else %}
connection: "sql_server"
{% endif %}

 

 That doesn't work since apparently Liquid can't be used there.  

2.  Altering the connection attributes based on user_attributes:

burns44_0-1712924656243.png

This doesn't work.  Although you can dynamically route users to different databases within (say) SQL Server using attributes, you can't point them to a connection with a different dialect.

Is this possible using Looker?

 

0 2 143
2 REPLIES 2

Awesome use case, I love the idea of gradually shifting users to use the new connection.

I think both options will lead to dead ends. I don't think it's possible to get Liquid anywhere near the connection name in the LookML, and I know the connection attributes are only meant to change between different instances of the same DB type, as you mentioned.

I think this is a feature request. One workaround could be to change over individual Looks/dashboards in a gradual manner rather than the users.

Thanks Sam - glad I wasn't missing anything since the individual looker/dashboard migration is a lot more daunting (a lot of these are shared objects!).  But I think I'm all set either way, thanks!!

Top Labels in this Space
Top Solution Authors