Question

I have a Tableau application that works above RedShift. I have many set of data tables saved in different schemas. Each schema has exactly the same tables in the same format.

I also have a set of users. Each user should work with his own schema only (I have a table of mappings between users and schemas).

The question is how to make Tableau look on a different schema depending on the current username?

Thanks!

Was it helpful?

Solution

Redshift doesn't have the sort of capacity to set a default schema as one can set a default database in MSSQL, but perhaps you can use the search_path functionality, where when the user logs in, Tableau queries the user/schema map table then sets the search_path to that schema. Any subsequent queries look for tables/views in that schema first. See http://docs.aws.amazon.com/redshift/latest/dg/r_search_path.html for more info on search_path.

OTHER TIPS

I don't think you can dynamically change the schema name based on username.

Tableau workbooks (non packaged) are just xml files that are pretty human readable.

In the xml the connection is defined.. assuming you have a list of schema/user mappings you could probably just write a little script to generate a bunch of workbooks modifying just the schema and setting permissions correctly with tabcmd.

Two things to note though:

  1. Editing the XML is generally not supported by Tableau.
  2. I've done something similar with MSSQL (swapping databases dev, test and prod) so I'm not sure the syntax for the Redshift connection but assume its pretty similar.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top