Skip to content

Commit

Permalink
updated functions to use TOM enum
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Jun 6, 2024
1 parent 3d861d3 commit 715579e
Show file tree
Hide file tree
Showing 32 changed files with 187 additions and 224 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
3 changes: 1 addition & 2 deletions sempy_labs/ClearCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def clear_cache(dataset: str, workspace: Optional[str] = None):
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/CreateBlankSemanticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def create_blank_semantic_model(dataset: str, compatibility_level: Optional[int]
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/CreatePQTFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def create_pqt_file(dataset: str, workspace: Optional[str] = None, file_name: Op
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if file_name is None:
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/DirectLakeSchemaCompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def direct_lake_schema_compare(dataset: str, workspace: Optional[str] = None, la
Returns
-------
str
Shows tables/columns which exist in the semantic model but do not exist in the corresponding lakehouse.
"""

if workspace == None:
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/DirectLakeSchemaSync.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def direct_lake_schema_sync(dataset: str, workspace: Optional[str] = None, add_t
Returns
-------
str
A list of columns which exist in the lakehouse but not in the Direct Lake semantic model. If 'add_to_model' is set to True, a printout stating the success/failure of the operation is returned.
"""

sempy.fabric._client._utils._init_analysis_services()
Expand Down
6 changes: 2 additions & 4 deletions sempy_labs/GenerateReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def create_report_from_reportjson(report: str, dataset: str, report_json: str, t
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down Expand Up @@ -164,8 +163,7 @@ def update_report_from_reportjson(report: str, report_json: str, workspace: Opti
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
6 changes: 2 additions & 4 deletions sempy_labs/GenerateSemanticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def create_semantic_model_from_bim(dataset: str, bim_file: str, workspace: Optio
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down Expand Up @@ -116,8 +115,7 @@ def deploy_semantic_model(dataset: str, new_dataset: Optional[str] = None, works
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
3 changes: 2 additions & 1 deletion sempy_labs/GetDirectLakeLakehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sempy.fabric as fabric
from .HelperFunctions import resolve_lakehouse_id, resolve_lakehouse_name, get_direct_lake_sql_endpoint
from typing import List, Optional, Union
from uuid import UUID

def get_direct_lake_lakehouse(dataset: str, workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None):

Expand All @@ -26,7 +27,7 @@ def get_direct_lake_lakehouse(dataset: str, workspace: Optional[str] = None, lak
Returns
-------
str, str
str, UUID
The lakehouse name and lakehouse ID.
"""

Expand Down
2 changes: 1 addition & 1 deletion sempy_labs/GetSemanticModelBim.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_semantic_model_bim(dataset: str, workspace: Optional[str] = None, save_t
Returns
-------
Model.bim
str
The Model.bim file for the semantic model.
"""

Expand Down
5 changes: 2 additions & 3 deletions sempy_labs/Lakehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def optimize_lakehouse_tables(tables: Optional[Union[str, List[str]]] = None, la
Returns
-------
str
A printout stating the success/failure of the operation.
"""
"""

from .GetLakehouseTables import get_lakehouse_tables

Expand Down
6 changes: 2 additions & 4 deletions sempy_labs/ListFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,7 @@ def create_warehouse(warehouse: str, description: Optional[str] = None, workspac
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down Expand Up @@ -875,8 +874,7 @@ def update_item(item_type: str, current_name: str, new_name: str, description: O
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
6 changes: 2 additions & 4 deletions sempy_labs/MigrateCalcTablesToLakehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def migrate_calc_tables_to_lakehouse(dataset: str, new_dataset: str, workspace:
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down Expand Up @@ -202,8 +201,7 @@ def migrate_field_parameters(dataset: str, new_dataset: str, workspace: Optional
Returns
-------
str
A printout stating the success/failure of the operation.
"""

from .HelperFunctions import format_dax_object_name
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/MigrateCalcTablesToSemanticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def migrate_calc_tables_to_semantic_model(dataset: str, new_dataset: str, worksp
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/MigrateModelObjectsToSemanticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def migrate_model_objects_to_semantic_model(dataset: str, new_dataset: str, work
Returns
-------
str
A printout stating the success/failure of the operation.
"""

sempy.fabric._client._utils._init_analysis_services()
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/MigrateTablesColumnsToSemanticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def migrate_tables_columns_to_semantic_model(dataset: str, new_dataset: str, wor
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/ModelAutoBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def model_auto_build(dataset: str, file_path: str, workspace: Optional[str] = No
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace is None:
Expand Down
2 changes: 1 addition & 1 deletion sempy_labs/ModelBPA.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def model_bpa_rules():
def run_model_bpa(dataset: str, rules_dataframe: Optional[pd.DataFrame] = None, workspace: Optional[str] = None, export: Optional[bool] = False, return_dataframe: Optional[bool] = False, **kwargs):

"""
Runs the Best Practice Rules against a semantic model.
Displays an HTML visualization of the results of the Best Practice Analyzer scan for a semantic model.
Parameters
----------
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/OneLakeIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def export_model_to_onelake(dataset: str, workspace: Optional[str] = None, desti
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
18 changes: 6 additions & 12 deletions sempy_labs/QSO.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def qso_sync(dataset: str, workspace: Optional[str] = None):
Returns
-------
str
A printout stating the success/failure of the operation.
"""

#https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/trigger-query-scale-out-sync-in-group
Expand Down Expand Up @@ -64,8 +63,7 @@ def qso_sync_status(dataset: str, workspace: Optional[str] = None):
Returns
-------
str
A printout stating the success/failure of the operation.
"""

#https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/get-query-scale-out-sync-status-in-group
Expand Down Expand Up @@ -130,8 +128,7 @@ def disable_qso(dataset: str, workspace: Optional[str] = None):
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace is None:
Expand Down Expand Up @@ -177,8 +174,7 @@ def set_qso(dataset: str, auto_sync: Optional[bool] = True, max_read_only_replic
Returns
-------
str
A printout stating the success/failure of the operation.
"""

#https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-dataset-in-group
Expand Down Expand Up @@ -236,8 +232,7 @@ def set_semantic_model_storage_format(dataset: str, storage_format: str, workspa
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace is None:
Expand Down Expand Up @@ -343,8 +338,7 @@ def set_workspace_default_storage_format(storage_format: str, workspace: Optiona
Returns
-------
str
A printout stating the success/failure of the operation.
"""

#https://learn.microsoft.com/en-us/rest/api/power-bi/groups/update-group#defaultdatasetstorageformat
Expand Down
3 changes: 1 addition & 2 deletions sempy_labs/RefreshCalcTables.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def refresh_calc_tables(dataset: str, workspace: Optional[str] = None):
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
6 changes: 2 additions & 4 deletions sempy_labs/RefreshSemanticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def refresh_semantic_model(dataset: str, tables: Optional[Union[str, List[str]]]
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down Expand Up @@ -120,8 +119,7 @@ def cancel_dataset_refresh(dataset: str, request_id: Optional[str] = None, works
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if workspace == None:
Expand Down
14 changes: 5 additions & 9 deletions sempy_labs/ReportFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_report_json(report: str, workspace: Optional[str] = None, save_to_file_n
def report_dependency_tree(workspace: Optional[str] = None):

"""
Shows a dependency between reports and semantic models.
Prints a dependency between reports and semantic models.
Parameters
----------
Expand All @@ -98,8 +98,7 @@ def report_dependency_tree(workspace: Optional[str] = None):
Returns
-------
str
A dependency tree showing the relationship between reports and semantic models.
"""

if workspace == None:
Expand Down Expand Up @@ -166,8 +165,7 @@ def export_report(report: str, export_format: str, file_name: Optional[str] = No
Returns
-------
str
A printout stating the success/failure of the operation.
"""

#https://learn.microsoft.com/rest/api/power-bi/reports/export-to-file-in-group
Expand Down Expand Up @@ -376,8 +374,7 @@ def clone_report(report: str, cloned_report: str, workspace: Optional[str] = Non
Returns
-------
str
A printout stating the success/failure of the operation.
"""

#https://learn.microsoft.com/rest/api/power-bi/reports/clone-report-in-group
Expand Down Expand Up @@ -667,8 +664,7 @@ def translate_report_titles(report: str, languages: Union[str,List[str]], worksp
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if isinstance(languages, str):
Expand Down
6 changes: 2 additions & 4 deletions sempy_labs/ReportRebind.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def report_rebind(report: str, dataset: str, report_workspace: Optional[str] = N
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if report_workspace == None:
Expand Down Expand Up @@ -90,8 +89,7 @@ def report_rebind_all(dataset: str, new_dataset: str, dataset_workspace: Optiona
Returns
-------
str
A printout stating the success/failure of the operation.
"""

if dataset_workspace == None:
Expand Down
Loading

0 comments on commit 715579e

Please sign in to comment.