VizAlerts
VizAlerts copied to clipboard
Add subscriber_groups and owner_groups to VizAlerts schedule viz
This is something Matt & I talked about at one point in the development of VizAlerts 2.0: The idea is to have concatenated strings (delimited by a field that is not allowed for Tableau Server group names, or some set of characters that is likely to be unique if one doesn't exist) of the groups that the subscriber and viz owner belong to.
The use case for this is that we could write more specialized formulas for filtering who can subscribe and/or create trigger views based on their group membership. For example a filter like CONTAINS([owner_groups], "VizAlertsOK") could restrict to only publishers in the VizAlertsOK group.
I believe the string_agg() function https://www.postgresql.org/docs/9.4/static/functions-aggregate.html used in a subquery that is joined to the custom SQL would work here.
Just spitballing here...so I've found there's a limit in the CSV download to how much data will show from a particular field. It's around 3k characters. I rather doubt anyone would be in so many groups that they'd hit that, but it's definitely possible, so we'd want to control for that, maybe by truncating the string or throwing an email failure when it gets too big. Another thing to think about is performance...we have to run this query every minute, so it's important that it returns quickly and reliably. I rather doubt using this function would cause a problem, as we've used it in the past for other stuff in our data with no issues, but we should test it. This would be very useful!