tableau / TabPy

Execute Python code on the fly and display results in Tableau visualizations:
https://tableau.github.io/TabPy/
MIT License
1.56k stars 598 forks source link

'Client' object has no attribute 'remove' #374

Closed rloomer closed 4 years ago

rloomer commented 4 years ago

Environment information:

Describe the issue I am getting the error "'Client' object has no attribute 'remove'" when attempting to execute: client.remove('myfunction')

To Reproduce Executing from Anaconda prompt (version 4.3.0):

from tabpy.tabpy_tools.client import Client client=Client('http://localhost:9004') client.remove('GermanCreditCheck')

AttributeError: 'Client' object has no attribute 'remove'

Expected behavior The 'GermanCreditCheck' endpoint should have been removed, but the 'remove' method in the Client object was not available to perform the function.

Screenshots tabpy error

Additional context The tabpy\tabpy_tools\client.py file in prior versions included: def remove(self, name) but it is not available in the current 0.8.9 release.

There is no apparent way to now be able to remove a function from the list of endpoints.

phantomcosmonaut commented 4 years ago

You're right, that method doesn't seem to exists for that class. But from the RESTServiceClient class is the following method:

def remove_endpoint(self, endpoint_name):
        """Deletes an endpoint through the management API.
        Parameters
        ----------
        endpoint_name : str
            The endpoint to delete.
        """
        self.service_client.DELETE('endpoints/'+endpoint_name)

That class corresponds to the Client service attribute: self._service = RESTServiceClient(service_client) So therefore you should be able to run: client._service.remove_endpoint('GermanCreditCheck')

0golovatyi commented 4 years ago

The fix is added in PR https://github.com/tableau/TabPy/pull/388

0golovatyi commented 4 years ago

The fix is in published package v0.9.0.