Set model connection name dynamically

  • 18 November 2022
  • 4 replies


I cannot believe this is so difficult to find an answer to.

We are embedding Looker dashboards via SSO signed URLs in an iframe. This iframe will be served in different client environments, and of course we need a separate connection per environment. We need to be able to set a model connection NAME dynamically, possibly via user attributes.

The link below talks about parameterised connections, but I don’t want to get PARAMETERS of a connection from user attributes, I want to set connections in my connections list, and then based on a user attribute value choose one of these connections. So in my model LookML I would have:

connection: {{_user_attributes[‘connection’]}}


Is this possible?



4 replies

Userlevel 7

The link you posted is talking about connection config using user attributes (admin stuff) - read about creating connections to see if the things you can change there using user attributes would work for you (eg change of a schema or gcp project).

Userlevel 7

And no not possible to do as you are trying.

Thanks @IanT - yeah it doesn’t look possible the way I want to do. But surely this is such a common need, people have different testing and staging environments. I cannot be expected to provided username/password/hostname.. etc as part of user attributes, I’m embedding the reports, so that is not even an option, my user attributes go in a URL!

@uglyprince I have raised the same request with looker support on 12 December 2022. This one is really a good to have feature.


User attributes in connection parameter works fine for most DBs but not for GCP BIGQUERY, because it requires credentials file below which cannot be dynamically passed based on user attribute. This is causing a lot of complexities in switching between environments..

Service Account JSON/P12 File