Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementing missing api's #31

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update pbiapi.py
  • Loading branch information
amitca71 authored Oct 24, 2021
commit 651fc97dd1dc4f79208832288c61fa619be69790
14 changes: 8 additions & 6 deletions pbiapi/pbiapi.py
Original file line number Diff line number Diff line change
@@ -300,7 +300,11 @@ def truncate_table(self, workspace_name: str, dataset_id: str, table_name: str)
else:
logging.error("Table truncation failed!")
self.force_raise_http_error(response)

@check_token
def is_report_in_workspace(self, workspace_id: str, report_name: str):
reports = self.get_reports_in_workspace_by_id(workspace_id)
report_id_list = self.find_entities_list_id_by_name(reports, report_name, "report")
return (len (report_id_list)>0 )
@check_token
def get_reports_in_workspace(self, workspace_name: str) -> List:
workspace_id = self.find_entity_id_by_name(self.workspaces, workspace_name, "workspace", raise_if_missing=True)
@@ -355,14 +359,12 @@ def delete_report(self, workspace_name: str, report_name: str) -> None:

@check_token
def import_file_into_workspace(
self, workspace_name: str, skip_report: bool, file_path: str, display_name: str
self, workspace_name: str, skip_report: bool, file_path: str, display_name: str, name_conflict: str ='CreateOrOverwrite'
) -> None:
workspace_id = self.find_entity_id_by_name(self.workspaces, workspace_name, "workspace", raise_if_missing=True)

if not os.path.isfile(file_path):
raise FileNotFoundError(2, f"No such file or directory: '{file_path}'")

name_conflict = "CreateOrOverwrite"
raise FileNotFoundError(2, f"No such file or directory: '{file_path}'")
url = (
self.base_url
+ f"groups/{workspace_id}/imports?datasetDisplayName={display_name}&nameConflict="
@@ -790,4 +792,4 @@ def delete_reports_by_workspace_id(self, workspace_id: str, report_name: str) ->
logging.info(f"Report named '{report_name}' with id '{report_id}' in workspace '{workspace_id}' deleted successfully!")
else:
logging.error("Report deletion failed!")
self.force_raise_http_error(response)
self.force_raise_http_error(response)