divinorum-webb / tableau-api-lib

An API library that allows developers to call on the methods listed in Tableau's REST API documentation.
MIT License
96 stars 34 forks source link

Clone_group under utils.cloning group.py #65

Closed agrasurbhi closed 2 years ago

agrasurbhi commented 2 years ago

I am using clone_groups function defined under utils.cloning group.py.

The groups which are present in source Tableau server but not present in Tableau Target connection are cloned using this function (and working fine) ie they are created under a site in Tableau Target connection The group are getting created but the users are not getting pupulated though I have set populate_users as True.

res=groups.clone_groups(source_conn,
                 target_conn,
                 populate_users=True,
                 overwrite_policy='overwrite')

Please guide as my souce conenction already has users added under my source group dataframe

Also can you guide what is group_names=None and group_mapping_file variables are used for under below code :-

def clone_groups(conn_source,
                 conn_target,
                 group_names=None,
                 populate_users=False,
                 group_mapping_file=None,
                 overwrite_policy=None) -> list:
divinorum-webb commented 2 years ago

Hey @agrasurbhi all of the utils.cloning logic was experimental three years ago and may not accommodate all of the nuances of server environments that may exist today. I've considered removing it entirely, but some aspects of these cloning functions have been useful to people so it has survived.

If your target server does not yet have users created, you'll want to first use the utils/cloning/users/clone_users function to clone users into the target server before attempting to populate those users into your groups. Setting populate_users=True does attempt to populate users into your cloned groups, however the users it references are the users which currently exist in your target server.

In general when cloning content from one server to another, I'd recommend this order:

  1. clone the sites
  2. clone the users
  3. clone the projects
  4. clone the groups

The group_mapping_file is not used in this function, and the intention of having it in the first place was to support scenarios where 'Group A' on the source server should be mapped to 'Group B' on the destination server (you clone the groups but map the old names to some new naming convention). This feature was not fully implemented, which is why that parameter exists without being used.

Hope that helps!