Skip to content

Commit

Permalink
Update datasources_endpoint.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jacalata committed Dec 28, 2024
1 parent a3bd630 commit 8cf8226
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tableauserverclient/server/endpoint/datasources_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,12 @@ def publish(
else:
raise TypeError("file should be a filepath or file object.")

if not mode or not hasattr(self.parent_srv.PublishMode, mode):
error = "Invalid mode defined."
raise ValueError(error)

# Construct the url with the defined mode
url = f"{self.baseurl}?datasourceType={file_extension}"
if mode == self.parent_srv.PublishMode.Overwrite or mode == self.parent_srv.PublishMode.Append:
if not mode or not hasattr(self.parent_srv.PublishMode, mode):
error = f"Invalid mode defined: {mode}"
raise ValueError(error)
else:
url += f"&{mode.lower()}=true"

if as_job:
Expand Down

0 comments on commit 8cf8226

Please sign in to comment.