I'm trying to pass groups information to a mysql database using connection attributes with Looker.
Looker support passing additional parameters and use liquid format for inserting user attributes, eg
connectionAttributes=looker.groups:{{_user_attributes['usergroup']}}
which will result in a JDBC string as such:
jdbc:mysql://host:port/mysql?connectionAttributes=looker.groups:ENGINEER,DEVELOPER
connectionAttributes use comma as it's own delimiter so above will be parsed as two value pairs on database side:
looker.groups:ENGINEER
DEVELOPER:<nothing>
I'm trying to figure out a way to pass both values (ENGINEER,DEVELOPER) under same key, changing delimiter to ; using liquid - but no success.
I've tried these
#in case usergroup is stored as string
{{_user_attributes['usergroup'] | replace: ",", ";"}}
#in case usergroup is stored as array
{{_user_attributes['usergroup'] | join: ";"}}
These are both not parsed by looker, but come back as-is
eg
jdbc:mysql://host:port/mysql?connectionAttributes=looker.groups:{{_user_attributes['usergroup'] | replace: ",", ";"}}
Do you have any ideas?
The answer to this question was easy, the userGroup
user attribute was user created (static), so changing that to use semicolon solve the problem statement above.
This raise another question, how to get the actual groups and not a static value - but I'll do my homework and spend some time to try figure that out.