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

Error when using delete_data_driven_alert() #51

Closed Thibault-Santonja closed 3 years ago

Thibault-Santonja commented 3 years ago

Hi, I've got the error bellow, I think it's due to a missing attribute in the DataAlertEndpoint() class, an attribute: _delete_data_alert. I have tried to add it and init it to True when I execute a deletion on a DataAlert. Next, I've specified this variable in the mutually_exclusive_params() method of this class, so that it will be checked during _validate_inputs() method call.

Finally, in tableau_server_connection.delete_data_driven_alert(), during the instantiation of the endpoint (creation of the DataAlertEndpoint() object), in addition to these parameters "ts_connection=self, data_alert_id=data_alert_id", I've passed the newly specified "delete_data_alert=True" parameter.

This is my Traceback :

Traceback (most recent call last):
  File "/main.py", line 49, in <module>
    post_clone_tasks.launch_post_clone_tasks(tableau_config, config='tableau_intg_FI')
  File "\post_clone_tasks.py", line 50, in launch_post_clone_tasks
    pam_tableau.delete_data_alerts(pam_tableau.get_site_data_alerts())
  File "\Tableau.py", line 111, in delete_data_alerts
    self.connection.delete_data_driven_alert(data_alert_id=data_alert[0])
  File "\AppData\Local\Programs\Python\Python38\lib\site-packages\tableau_api_lib\decorators\verification.py", line 189, in wrapper
    return func(self, *args, **kwargs)
  File "\AppData\Local\Programs\Python\Python38\lib\site-packages\tableau_api_lib\tableau_server_connection.py", line 543, in delete_data_driven_alert
    self.active_endpoint = api_endpoints.DataAlertEndpoint(
  File "\AppData\Local\Programs\Python\Python38\lib\site-packages\tableau_api_lib\api_endpoints\data_alert_endpoint.py", line 37, in __init__
    self._validate_inputs()
  File "\Local\Programs\Python\Python38\lib\site-packages\tableau_api_lib\api_endpoints\data_alert_endpoint.py", line 54, in _validate_inputs
    self._invalid_parameter_exception()
  File "\Local\Programs\Python\Python38\lib\site-packages\tableau_api_lib\api_endpoints\base_endpoint.py", line 41, in _invalid_parameter_exception
    raise InvalidParameterException(self.__class__.__name__,
tableau_api_lib.exceptions.custom_exceptions.InvalidParameterException: 
        "
DataAlertEndpoint received an invalid combination of parameters.
         Evaluate the parameters below and correct accordingly:
{'_connection': <tableau_api_lib.tableau_server_connection.TableauServerConnection object at 0x0000000001EE6610>, '_parameter_dict': None, '_query_data_alerts': False, '_query_data_alert': False, '_data_alert_id': '0e53ab73-40fc-42ac-9022-097e75ef5355', '_delete_data_alert': False, '_user_id': None, '_add_user': False, '_remove_user': False}

Is it correct ? Thank you !

divinorum-webb commented 3 years ago

Hi @Thibault-Santonja thanks for finding this, it is definitely a bug. The delete_data_driven_alert method has been updated. Can you run pip install -U tableau-api-lib and see if it is working for you now?

Thibault-Santonja commented 3 years ago

Thank you very much ! That's working :)