bigfunctions icon indicating copy to clipboard operation
bigfunctions copied to clipboard

[new]: `refresh_tableau(obj_title_to_refresh)`

Open AntoineGiraud opened this issue 2 years ago • 1 comments

Check the idea has not already been suggested

Edit the title above with self-explanatory function name and argument names

  • [X] The function name and the argument names I entered in the title above seems self explanatory to me.

BigFunction Description as it would appear in the documentation

refresh a tableau datasource/workbook via it's REST API by giving the object full title the python script will :

  • login to tableau via the secret tableau_credentials_json stored/configured in GCP
  • search for a datasource/workbook with the given title to fetch it's UID
  • launch a refresh, if accepted will return the api call json content
  • logout

The GCP secret tableau_credentials_json : JSON comportant les credentials tableau (Personnal Access Token or user/pswd) ainsi que le nom du serveur & la version d'API

{
    "server_name":"eu-west-1a.online.tableau.com",
    "api_version":"3.21",
    "credentials": {
          "personalAccessTokenName": "mon_token_xxx",
          "personalAccessTokenSecret": "xxx",
          "site": {"contentUrl": "monsitetableau" }
    }
}

Examples of (arguments, expected output) as they would appear in the documentation

  • obj_title_to_refresh="Pilotage vol. de leads" --> {'job': {'extractRefreshJob': {'workbook': {'id': '25c6ab67-fb6b-4357-be96-1d4fee23d479', 'name': 'Pilotage vol. de leads'}}, 'id': '2e6fa29e-476e-46b1-8653-deeeccddb0ea', 'mode': 'Asynchronous', 'type': 'RefreshExtract', 'createdAt': '2024-02-06T15:16:11Z'}}
  • obj_title_to_refresh="titre rapport inconnu" --> not found: titre rapport inconnu

AntoineGiraud avatar Feb 06 '24 17:02 AntoineGiraud

Hi @AntoineGiraud

I didn't realize you attached some code from your repo in this issue.

Could you create the merge request from your branch to unytics repo?

Then I merge it, do some eventual small adjustments and deploy it. I'll show you the small changes I made.

What do you think?

unytics avatar Jul 25 '24 20:07 unytics

merged! Thanks @AntoineGiraud 🥇

unytics avatar Sep 19 '24 15:09 unytics