hyperleaup icon indicating copy to clipboard operation
hyperleaup copied to clipboard

TypeError: publish() got an unexpected keyword argument 'file_path'

Open gobiviswanath opened this issue 4 years ago • 2 comments

https://community.databricks.com/s/question/0D53f00001Tgle2CAB/hyperleaup-to-push-data-to-tableau-server

` --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in 7 8 # Publish the Hyper File! ----> 9 luid = hf.publish(tableau_server_url=tableau_server, 10 username=username, 11 password=password,

/local_disk0/.ephemeral_nfs/envs/pythonEnv-9ce478c3-3c92-4e39-8fb0-576418e91fb7/lib/python3.8/site-packages/hyperleaup/hyper_file.py in publish(self, tableau_server_url, username, password, site_id, project_name, datasource_name)
     72         publisher = Publisher(tableau_server_url, username, password,
     73                               site_id, project_name, datasource_name, self.path)
---> 74         self.luid = publisher.publish()
     75         logging.info(f"Hyper File published to Tableau Server with datasource LUID : {self.luid}")
     76 
 
/local_disk0/.ephemeral_nfs/envs/pythonEnv-9ce478c3-3c92-4e39-8fb0-576418e91fb7/lib/python3.8/site-packages/hyperleaup/publisher.py in publish(self, creation_mode)
    104             datasource_item = TSC.DatasourceItem(project_id=self.project_id, name=self.datasource_name)
    105             logging.info(f'Publishing datasource: \n{datasource_to_string(datasource_item)}')
--> 106             datasource_item = server.datasources.publish(datasource_item=datasource_item,
    107                                                          file_path=self.hyper_file_path,
    108                                                          mode=create_mode)
 
/local_disk0/.ephemeral_nfs/envs/pythonEnv-9ce478c3-3c92-4e39-8fb0-576418e91fb7/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py in wrapper(self, *args, **kwargs)
    161         def wrapper(self, *args, **kwargs):
    162             self.parent_srv.assert_at_least_version(version)
--> 163             return func(self, *args, **kwargs)
    164 
    165         return wrapper
 
/local_disk0/.ephemeral_nfs/envs/pythonEnv-9ce478c3-3c92-4e39-8fb0-576418e91fb7/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py in wrapper(self, *args, **kwargs)
    203                     error = "{!r} not available in {}, it will be ignored. Added in {}".format(p, server_ver, min_ver)
    204                     warnings.warn(error)
--> 205             return func(self, *args, **kwargs)
    206 
    207         return wrapper
 
/local_disk0/.ephemeral_nfs/envs/pythonEnv-9ce478c3-3c92-4e39-8fb0-576418e91fb7/lib/python3.8/site-packages/tableauserverclient/server/endpoint/endpoint.py in wrapper(self, *args, **kwargs)
    203                     error = "{!r} not available in {}, it will be ignored. Added in {}".format(p, server_ver, min_ver)
    204                     warnings.warn(error)
--> 205             return func(self, *args, **kwargs)
    206 
    207         return wrapper
 
TypeError: publish() got an unexpected keyword argument 'file_path'`

gobiviswanath avatar Nov 24 '21 04:11 gobiviswanath

There is a bug in line 107 of https://github.com/goodwillpunning/hyperleaup/blob/master/hyperleaup/publisher.py

The expected arg passing is filepath but it is defined as file_path.

                datasource_item = server.datasources.publish(datasource_item=datasource_item,
                                                             filepath=self.hyper_file_path,
                                                             mode=create_mode)

Ref: line 190- argument acceptance syntax in dependant library: https://github.com/tableau/server-client-python/blob/master/tableauserverclient/server/endpoint/endpoint.py

gobiviswanath avatar Nov 24 '21 04:11 gobiviswanath

This should be addressed in my pull request made today.

harrywatts125 avatar Feb 24 '22 14:02 harrywatts125