Extracting the entire user list in a user group using tableau_api_lib

22 views Asked by At

I have a question.

I need to extract all the users in tableau groups and put that one in to a dataframe. Columns I need are, group id, user name these two

from tableau_api_lib import TableauServerConnection
import pandas as pd
from tableau_api_lib.utils.querying import get_workbooks_dataframe, get_datasources_dataframe
import pandas as pd
from tableau_api_lib.utils.querying import get_views_dataframe
from tableau_api_lib.utils.querying import get_workbooks_dataframe
from tableau_api_lib.utils.querying import get_users_dataframe
from tableau_api_lib.utils.querying import get_groups_dataframe

tableau_server_config = {
        'my_env': {
                'server': 'https://tableau-eu.cloud.server.com',
                'api_version': '3.21',
                'username': 'name',
                'password': 'pass',
                'site_name': 'FT',
                'site_url': 'FT'
        }
}

conn = TableauServerConnection(tableau_server_config, env='my_env')
conn.sign_in()
users_df = get_users_dataframe(conn=conn)
groups_df = get_groups_dataframe(conn=conn)

groups_df.to_excel(r'C:\tmp\python\groups.xlsx', index=False)

This python code works perfectly and exports an excel actually. But the issue is we cannot retrieve the users who are in a particular group. as an example I need to get the users who are in groups - All Users and Developers. Below extracts the entire user list

users_df = get_users_dataframe(conn=conn)

Do you have any idea on how tro do that?

We cannot use tableau Rest API via python as we dont have access to it.

Any idea on how to do that?

0

There are 0 answers