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

M kovalsky/scannerapi #194

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Semantic Link Labs

[![PyPI version](https://badge.fury.io/py/semantic-link-labs.svg)](https://badge.fury.io/py/semantic-link-labs)
[![Read The Docs](https://readthedocs.org/projects/semantic-link-labs/badge/?version=0.8.2&style=flat)](https://readthedocs.org/projects/semantic-link-labs/)
[![Read The Docs](https://readthedocs.org/projects/semantic-link-labs/badge/?version=0.8.5&style=flat)](https://readthedocs.org/projects/semantic-link-labs/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Downloads](https://static.pepy.tech/badge/semantic-link-labs)](https://pepy.tech/project/semantic-link-labs)

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
project = 'semantic-link-labs'
copyright = '2024, Microsoft and community'
author = 'Microsoft and community'
release = '0.8.2'
release = '0.8.5'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- pytest-cov
- pytest-mock
- pip:
- semantic-link-sempy>=0.8.0
- semantic-link-sempy>=0.8.2
- azure-identity==1.7.1
- azure-storage-blob>=12.9.0
- pandas-stubs
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name="semantic-link-labs"
authors = [
{ name = "Microsoft Corporation" },
]
version="0.8.2"
version="0.8.5"
description="Semantic Link Labs for Microsoft Fabric"
readme="README.md"
requires-python=">=3.10,<3.12"
Expand All @@ -23,7 +23,7 @@ classifiers = [
license= { text = "MIT License" }

dependencies = [
"semantic-link-sempy>=0.8.0",
"semantic-link-sempy>=0.8.2",
"anytree",
"powerbiclient",
"polib",
Expand Down
6 changes: 6 additions & 0 deletions src/sempy_labs/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from sempy_labs.admin._scanner import (
scan_workspaces,
ScannerWrapper,
)
from sempy_labs.admin._basic_functions import (
assign_workspaces_to_capacity,
list_capacities,
Expand Down Expand Up @@ -50,4 +54,6 @@
"unassign_workspaces_from_capacity",
"list_external_data_shares",
"revoke_external_data_share",
"scan_workspaces",
"ScannerWrapper",
]
43 changes: 0 additions & 43 deletions src/sempy_labs/admin/_basic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import datetime
import numpy as np
import pandas as pd
import time


def list_workspaces(
Expand Down Expand Up @@ -479,48 +478,6 @@ def list_capacities_delegated_tenant_settings(
return combined_response


def scan_workspaces(
data_source_details: bool = False,
dataset_schema: bool = False,
dataset_expressions: bool = False,
lineage: bool = False,
artifact_users: bool = False,
workspace: Optional[str | List[str]] = None,
) -> dict:

workspace = fabric.resolve_workspace_name(workspace)

if isinstance(workspace, str):
workspace = [workspace]

workspace_list = []

for w in workspace:
workspace_list.append(fabric.resolve_workspace_id(w))

client = fabric.PowerBIRestClient()
request_body = {"workspaces": workspace_list}

response_clause = f"/v1.0/myorg/admin/workspaces/getInfo?lineage={lineage}&datasourceDetails={data_source_details}&datasetSchema={dataset_schema}&datasetExpressions={dataset_expressions}&getArtifactUsers={artifact_users}"
response = client.post(response_clause, json=request_body)

if response.status_code != 202:
raise FabricHTTPException(response)
scan_id = response.json()["id"]
scan_status = response.json().get("status")
while scan_status not in ["Succeeded", "Failed"]:
time.sleep(1)
response = client.get(f"/v1.0/myorg/admin/workspaces/scanStatus/{scan_id}")
scan_status = response.json().get("status")
if scan_status == "Failed":
raise FabricHTTPException(response)
response = client.get(f"/v1.0/myorg/admin/workspaces/scanResult/{scan_id}")
if response.status_code != 200:
raise FabricHTTPException(response)

return response.json()


def list_datasets() -> pd.DataFrame:
"""
Shows a list of datasets for the organization.
Expand Down
Loading