goodwillpunning / hyperleaup

Create and manipulate Tableau Hyper files from Apache Spark DataFrames and Spark SQL
Other
29 stars 19 forks source link

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

Closed AymanAlneser closed 3 years ago

AymanAlneser commented 3 years ago

when I try to publish to tableau using this code

luid = hf.publish(tableau_server_url=tableau_server, username=username, password=password, site_id=site_id, project_name=project_name, datasource_name=datasource_name) print(f'Published Hyper File as new datasource luid: {luid}')

I get the error : TypeError: publish() got an unexpected keyword argument 'file_path'

I saw that Publish() does not expect the path argument

TypeError Traceback (most recent call last)

in 10 site_id=site_id, 11 project_name=project_name, ---> 12 datasource_name=datasource_name) 13 print(f'Published Hyper File as new datasource luid: {luid}') /local_disk0/spark-5012ed7b-4e9f-487f-9500-8c37367b319f/userFiles-6477f5f1-b60c-4179-b250-2b69874dcbec/addedFile878069350975747133073ddc9d6_1e43_4bdc_b1c9_120cc5637a38_hyperleaup_0_0_5_py3_6_6cc48-9d1d7.egg/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/spark-5012ed7b-4e9f-487f-9500-8c37367b319f/userFiles-6477f5f1-b60c-4179-b250-2b69874dcbec/addedFile878069350975747133073ddc9d6_1e43_4bdc_b1c9_120cc5637a38_hyperleaup_0_0_5_py3_6_6cc48-9d1d7.egg/hyperleaup/publisher.py in publish(self, creation_mode) 106 datasource_item = server.datasources.publish(datasource_item=datasource_item, 107 file_path=self.hyper_file_path, --> 108 mode=create_mode) 109 self.datasource_luid = datasource_item.id 110 logging.info(f'Published datasource to Tableau server. Datasource LUID : {self.datasource_luid}') /databricks/python/lib/python3.7/site-packages/tableauserverclient/server/endpoint/endpoint.py in wrapper(self, *args, **kwargs) 125 def wrapper(self, *args, **kwargs): 126 self.parent_srv.assert_at_least_version(version) --> 127 return func(self, *args, **kwargs) 128 return wrapper 129 return _decorator /databricks/python/lib/python3.7/site-packages/tableauserverclient/server/endpoint/endpoint.py in wrapper(self, *args, **kwargs) 163 error = "{!r} not available in {}, it will be ignored. Added in {}".format(p, server_ver, min_ver) 164 warnings.warn(error) --> 165 return func(self, *args, **kwargs) 166 return wrapper 167 return _decorator /databricks/python/lib/python3.7/site-packages/tableauserverclient/server/endpoint/endpoint.py in wrapper(self, *args, **kwargs) 163 error = "{!r} not available in {}, it will be ignored. Added in {}".format(p, server_ver, min_ver) 164 warnings.warn(error) --> 165 return func(self, *args, **kwargs) 166 return wrapper 167 return _decorator TypeError: publish() got an unexpected keyword argument 'file_path'
AymanAlneser commented 3 years ago

Found the issue in publisher.py datasource_item = server.datasources.publish(datasource_item=datasource_item, file=self.hyper_file_path, mode=create_mode)

the argument is called file not file path , even though the docs from tableau says it should be file_path changing this has fixed the issue for me