From 5f420708452f578ad27e1bdf8ccb198665117f2f Mon Sep 17 00:00:00 2001 From: Michael Kovalsky Date: Fri, 7 Jun 2024 12:06:18 +0300 Subject: [PATCH 1/3] versioning --- sempy_labs/CreatePQTFile.py | 4 ++-- sempy_labs/DirectLakeSchemaSync.py | 4 ++-- sempy_labs/ListDirectLakeModelCalcTables.py | 4 ++-- sempy_labs/LogAnalytics.py | 4 ++-- sempy_labs/MeasureDependencyTree.py | 4 ++-- sempy_labs/MigrateCalcTablesToLakehouse.py | 6 +++--- sempy_labs/MigrateCalcTablesToSemanticModel.py | 4 ++-- sempy_labs/MigrateModelObjectsToSemanticModel.py | 4 ++-- sempy_labs/MigrateTablesColumnsToSemanticModel.py | 4 ++-- sempy_labs/MigrationValidation.py | 4 ++-- sempy_labs/ModelAutoBuild.py | 4 ++-- sempy_labs/ModelBPA.py | 4 ++-- sempy_labs/OneLakeIntegration.py | 4 ++-- sempy_labs/RefreshCalcTables.py | 4 ++-- sempy_labs/RefreshSemanticModel.py | 6 +++--- sempy_labs/ReportFunctions.py | 4 ++-- sempy_labs/ReportRebind.py | 6 +++--- sempy_labs/TOM.py | 4 ++-- sempy_labs/Translations.py | 4 ++-- sempy_labs/Vertipaq.py | 6 +++--- sempy_labs/WarmCache.py | 6 +++--- setup.py | 2 +- 22 files changed, 48 insertions(+), 48 deletions(-) diff --git a/sempy_labs/CreatePQTFile.py b/sempy_labs/CreatePQTFile.py index f3303b2f..6c71f5bc 100644 --- a/sempy_labs/CreatePQTFile.py +++ b/sempy_labs/CreatePQTFile.py @@ -5,7 +5,7 @@ import xml.etree.ElementTree as ET from .ListFunctions import list_tables from .Lakehouse import lakehouse_attached -from sempy._utils._log import log + from typing import List, Optional, Union green_dot = '\U0001F7E2' @@ -13,7 +13,7 @@ red_dot = '\U0001F534' in_progress = '⌛' -@log + def create_pqt_file(dataset: str, workspace: Optional[str] = None, file_name: Optional[str] = None): """ diff --git a/sempy_labs/DirectLakeSchemaSync.py b/sempy_labs/DirectLakeSchemaSync.py index 8ea4017e..9287a857 100644 --- a/sempy_labs/DirectLakeSchemaSync.py +++ b/sempy_labs/DirectLakeSchemaSync.py @@ -4,9 +4,9 @@ from .GetLakehouseColumns import get_lakehouse_columns from .HelperFunctions import format_dax_object_name, resolve_lakehouse_name, get_direct_lake_sql_endpoint from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def direct_lake_schema_sync(dataset: str, workspace: Optional[str] = None, add_to_model: Optional[bool] = False, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ diff --git a/sempy_labs/ListDirectLakeModelCalcTables.py b/sempy_labs/ListDirectLakeModelCalcTables.py index 3eac1966..da653d5d 100644 --- a/sempy_labs/ListDirectLakeModelCalcTables.py +++ b/sempy_labs/ListDirectLakeModelCalcTables.py @@ -3,9 +3,9 @@ import pandas as pd from .ListFunctions import list_tables, list_annotations from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def list_direct_lake_model_calc_tables(dataset: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/LogAnalytics.py b/sempy_labs/LogAnalytics.py index 8b4cacad..098b4bbe 100644 --- a/sempy_labs/LogAnalytics.py +++ b/sempy_labs/LogAnalytics.py @@ -3,9 +3,9 @@ import pandas as pd from .HelperFunctions import resolve_dataset_id from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def run_dax(dataset: str, dax_query: str, user_name: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/MeasureDependencyTree.py b/sempy_labs/MeasureDependencyTree.py index 17a3b649..ef557e45 100644 --- a/sempy_labs/MeasureDependencyTree.py +++ b/sempy_labs/MeasureDependencyTree.py @@ -3,9 +3,9 @@ from anytree import Node, RenderTree from .GetMeasureDependencies import get_measure_dependencies from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def measure_dependency_tree(dataset: str, measure_name: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrateCalcTablesToLakehouse.py b/sempy_labs/MigrateCalcTablesToLakehouse.py index 67317272..faeed082 100644 --- a/sempy_labs/MigrateCalcTablesToLakehouse.py +++ b/sempy_labs/MigrateCalcTablesToLakehouse.py @@ -7,14 +7,14 @@ from .TOM import connect_semantic_model from pyspark.sql import SparkSession from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def migrate_calc_tables_to_lakehouse(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ @@ -178,7 +178,7 @@ def migrate_calc_tables_to_lakehouse(dataset: str, new_dataset: str, workspace: break time.sleep(1) -@log + def migrate_field_parameters(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrateCalcTablesToSemanticModel.py b/sempy_labs/MigrateCalcTablesToSemanticModel.py index 6b7e04cb..c505a3d7 100644 --- a/sempy_labs/MigrateCalcTablesToSemanticModel.py +++ b/sempy_labs/MigrateCalcTablesToSemanticModel.py @@ -5,14 +5,14 @@ from .HelperFunctions import resolve_lakehouse_name from .TOM import connect_semantic_model from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def migrate_calc_tables_to_semantic_model(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None ): """ diff --git a/sempy_labs/MigrateModelObjectsToSemanticModel.py b/sempy_labs/MigrateModelObjectsToSemanticModel.py index aa984255..ad0efabe 100644 --- a/sempy_labs/MigrateModelObjectsToSemanticModel.py +++ b/sempy_labs/MigrateModelObjectsToSemanticModel.py @@ -5,14 +5,14 @@ from .HelperFunctions import create_relationship_name from .TOM import connect_semantic_model from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def migrate_model_objects_to_semantic_model(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrateTablesColumnsToSemanticModel.py b/sempy_labs/MigrateTablesColumnsToSemanticModel.py index 47f5d054..d6458baa 100644 --- a/sempy_labs/MigrateTablesColumnsToSemanticModel.py +++ b/sempy_labs/MigrateTablesColumnsToSemanticModel.py @@ -8,14 +8,14 @@ from .Lakehouse import lakehouse_attached from .TOM import connect_semantic_model from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def migrate_tables_columns_to_semantic_model(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrationValidation.py b/sempy_labs/MigrationValidation.py index 150f7f78..48be5b52 100644 --- a/sempy_labs/MigrationValidation.py +++ b/sempy_labs/MigrationValidation.py @@ -4,7 +4,7 @@ from .HelperFunctions import create_relationship_name from .TOM import connect_semantic_model from typing import List, Optional, Union -from sempy._utils._log import log + def list_semantic_model_objects(dataset: str, workspace: Optional[str] = None): @@ -84,7 +84,7 @@ def list_semantic_model_objects(dataset: str, workspace: Optional[str] = None): return df -@log + def migration_validation(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None): """ diff --git a/sempy_labs/ModelAutoBuild.py b/sempy_labs/ModelAutoBuild.py index 6497061c..3595e69f 100644 --- a/sempy_labs/ModelAutoBuild.py +++ b/sempy_labs/ModelAutoBuild.py @@ -5,9 +5,9 @@ from .CreateBlankSemanticModel import create_blank_semantic_model from .GetSharedExpression import get_shared_expression from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def model_auto_build(dataset: str, file_path: str, workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ diff --git a/sempy_labs/ModelBPA.py b/sempy_labs/ModelBPA.py index 89f2ff97..bc77f498 100644 --- a/sempy_labs/ModelBPA.py +++ b/sempy_labs/ModelBPA.py @@ -10,7 +10,7 @@ from .Lakehouse import lakehouse_attached from .GetLakehouseTables import get_lakehouse_tables from typing import List, Optional, Union -from sempy._utils._log import log + def model_bpa_rules(): @@ -306,7 +306,7 @@ def model_bpa_rules(): return df_rules -@log + 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): """ diff --git a/sempy_labs/OneLakeIntegration.py b/sempy_labs/OneLakeIntegration.py index cd09c1fc..575c07ff 100644 --- a/sempy_labs/OneLakeIntegration.py +++ b/sempy_labs/OneLakeIntegration.py @@ -2,9 +2,9 @@ import sempy.fabric as fabric import pandas as pd from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def export_model_to_onelake(dataset: str, workspace: Optional[str] = None, destination_lakehouse: Optional[str] = None, destination_workspace: Optional[str] = None): """ diff --git a/sempy_labs/RefreshCalcTables.py b/sempy_labs/RefreshCalcTables.py index 010e9a0c..338760b9 100644 --- a/sempy_labs/RefreshCalcTables.py +++ b/sempy_labs/RefreshCalcTables.py @@ -5,14 +5,14 @@ from pyspark.sql import SparkSession from .TOM import connect_semantic_model from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def refresh_calc_tables(dataset: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/RefreshSemanticModel.py b/sempy_labs/RefreshSemanticModel.py index 599bbb7f..6efccbad 100644 --- a/sempy_labs/RefreshSemanticModel.py +++ b/sempy_labs/RefreshSemanticModel.py @@ -3,14 +3,14 @@ import time from .HelperFunctions import resolve_dataset_id from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def refresh_semantic_model(dataset: str, tables: Optional[Union[str, List[str]]] = None, partitions: Optional[Union[str, List[str]]] = None, refresh_type: Optional[str] = None, retry_count: Optional[int] = 0, apply_refresh_policy: Optional[bool] = True, workspace: Optional[str] = None): """ @@ -99,7 +99,7 @@ def extract_names(partition): print(f"{green_dot} Refresh of the '{dataset}' semantic model within the '{workspace}' workspace is complete.") -@log + def cancel_dataset_refresh(dataset: str, request_id: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/ReportFunctions.py b/sempy_labs/ReportFunctions.py index 6c6d3b52..af4d9d22 100644 --- a/sempy_labs/ReportFunctions.py +++ b/sempy_labs/ReportFunctions.py @@ -12,7 +12,7 @@ from .Lakehouse import lakehouse_attached from .HelperFunctions import generate_embedded_filter, resolve_dataset_name, resolve_report_id, resolve_lakehouse_name from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' @@ -136,7 +136,7 @@ def report_dependency_tree(workspace: Optional[str] = None): for pre, _, node in RenderTree(node_dict[workspace]): print(f"{pre}{node.custom_property}'{node.name}'") -@log + def export_report(report: str, export_format: str, file_name: Optional[str] = None, bookmark_name: Optional[str] = None, page_name: Optional[str] = None, visual_name: Optional[str] = None, report_filter: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/ReportRebind.py b/sempy_labs/ReportRebind.py index 844cc0b1..72ee3345 100644 --- a/sempy_labs/ReportRebind.py +++ b/sempy_labs/ReportRebind.py @@ -2,14 +2,14 @@ import sempy.fabric as fabric from .HelperFunctions import resolve_dataset_id, resolve_report_id from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def report_rebind(report: str, dataset: str, report_workspace: Optional[str] = None, dataset_workspace: Optional[str] = None): """ @@ -60,7 +60,7 @@ def report_rebind(report: str, dataset: str, report_workspace: Optional[str] = N else: print(f"{red_dot} The '{report}' report within the '{report_workspace}' workspace failed to rebind to the '{dataset}' semantic model within the '{dataset_workspace}' workspace.") -@log + def report_rebind_all(dataset: str, new_dataset: str, dataset_workspace: Optional[str] = None, new_dataset_workpace: Optional[str] = None, report_workspace: Optional[str] = None): """ diff --git a/sempy_labs/TOM.py b/sempy_labs/TOM.py index d5a18fff..384cca36 100644 --- a/sempy_labs/TOM.py +++ b/sempy_labs/TOM.py @@ -9,7 +9,7 @@ from .Fallback import check_fallback_reason from contextlib import contextmanager from typing import List, Optional, Union, TYPE_CHECKING -from sempy._utils._log import log + if TYPE_CHECKING: import Microsoft.AnalysisServices.Tabular @@ -23,7 +23,7 @@ start_bold = '\033[1m' end_bold = '\033[0m' -@log + @contextmanager def connect_semantic_model(dataset: str, readonly: Optional[bool] = True, workspace: Optional[str] = None): diff --git a/sempy_labs/Translations.py b/sempy_labs/Translations.py index 0f389ce3..cb80eb6b 100644 --- a/sempy_labs/Translations.py +++ b/sempy_labs/Translations.py @@ -1,6 +1,6 @@ import pandas as pd from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' @@ -42,7 +42,7 @@ def language_validate(language: str): return lang -@log + def translate_semantic_model(dataset: str, languages: Union[str, List[str]], exclude_characters: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/Vertipaq.py b/sempy_labs/Vertipaq.py index f88e08b3..f59e7bbc 100644 --- a/sempy_labs/Vertipaq.py +++ b/sempy_labs/Vertipaq.py @@ -9,9 +9,9 @@ from .GetLakehouseTables import get_lakehouse_tables from .Lakehouse import lakehouse_attached from typing import List, Optional, Union -from sempy._utils._log import log -@log + + def vertipaq_analyzer(dataset: str, workspace: Optional[str] = None, export: Optional[str] = None, lakehouse_workspace: Optional[str] = None, read_stats_from_data: Optional[bool] = False): """ @@ -532,7 +532,7 @@ def visualize_vertipaq(dataframes): # Default to open the first tab display(HTML("")) -@log + def import_vertipaq_analyzer(folder_path: str, file_name: str): """ diff --git a/sempy_labs/WarmCache.py b/sempy_labs/WarmCache.py index b4d340d0..b1b99d3b 100644 --- a/sempy_labs/WarmCache.py +++ b/sempy_labs/WarmCache.py @@ -8,14 +8,14 @@ from .RefreshSemanticModel import refresh_semantic_model from .GetMeasureDependencies import get_measure_dependencies from typing import List, Optional, Union -from sempy._utils._log import log + green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' -@log + def warm_direct_lake_cache_perspective(dataset: str, perspective: str, add_dependencies: Optional[bool] = False, workspace: Optional[str] = None): """ @@ -115,7 +115,7 @@ def warm_direct_lake_cache_perspective(dataset: str, perspective: str, add_depen return df -@log + def warm_direct_lake_cache_isresident(dataset: str, workspace: Optional[str] = None): """ diff --git a/setup.py b/setup.py index 24a4a224..f383e53d 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ long_description_content_type="text/markdown", packages=setuptools.find_packages(), install_requires=[ - 'semantic-link-sempy>=0.7.5', + 'semantic-link', 'anytree', 'powerbiclient', ], From 0cc29622953207d26d96ee330ca4816eaa78d3fe Mon Sep 17 00:00:00 2001 From: Michael Kovalsky Date: Sun, 9 Jun 2024 21:20:11 +0300 Subject: [PATCH 2/3] fixed shortcut file import --- sempy_labs/CreatePQTFile.py | 4 +- sempy_labs/DirectLakeSchemaSync.py | 4 +- sempy_labs/GetLakehouseColumns.py | 2 + sempy_labs/GetLakehouseTables.py | 2 + sempy_labs/GetMeasureDependencies.py | 3 + sempy_labs/Lakehouse.py | 2 + sempy_labs/ListDirectLakeModelCalcTables.py | 4 +- sempy_labs/LogAnalytics.py | 4 +- sempy_labs/MeasureDependencyTree.py | 4 +- sempy_labs/MigrateCalcTablesToLakehouse.py | 6 +- .../MigrateCalcTablesToSemanticModel.py | 4 +- .../MigrateModelObjectsToSemanticModel.py | 4 +- .../MigrateTablesColumnsToSemanticModel.py | 4 +- sempy_labs/MigrationValidation.py | 4 +- sempy_labs/ModelAutoBuild.py | 4 +- sempy_labs/ModelBPA.py | 4 +- sempy_labs/OneLakeIntegration.py | 4 +- sempy_labs/RefreshCalcTables.py | 4 +- sempy_labs/RefreshSemanticModel.py | 6 +- sempy_labs/ReportFunctions.py | 7 +- sempy_labs/ReportRebind.py | 6 +- sempy_labs/TOM.py | 4 +- sempy_labs/Translations.py | 4 +- sempy_labs/Vertipaq.py | 6 +- sempy_labs/WarmCache.py | 6 +- sempy_labs/__init__.py | 113 ++++++++++++++++++ sempy_labs/shortcuts.py | 2 +- 27 files changed, 172 insertions(+), 49 deletions(-) diff --git a/sempy_labs/CreatePQTFile.py b/sempy_labs/CreatePQTFile.py index 6c71f5bc..f3303b2f 100644 --- a/sempy_labs/CreatePQTFile.py +++ b/sempy_labs/CreatePQTFile.py @@ -5,7 +5,7 @@ import xml.etree.ElementTree as ET from .ListFunctions import list_tables from .Lakehouse import lakehouse_attached - +from sempy._utils._log import log from typing import List, Optional, Union green_dot = '\U0001F7E2' @@ -13,7 +13,7 @@ red_dot = '\U0001F534' in_progress = '⌛' - +@log def create_pqt_file(dataset: str, workspace: Optional[str] = None, file_name: Optional[str] = None): """ diff --git a/sempy_labs/DirectLakeSchemaSync.py b/sempy_labs/DirectLakeSchemaSync.py index 9287a857..8ea4017e 100644 --- a/sempy_labs/DirectLakeSchemaSync.py +++ b/sempy_labs/DirectLakeSchemaSync.py @@ -4,9 +4,9 @@ from .GetLakehouseColumns import get_lakehouse_columns from .HelperFunctions import format_dax_object_name, resolve_lakehouse_name, get_direct_lake_sql_endpoint from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def direct_lake_schema_sync(dataset: str, workspace: Optional[str] = None, add_to_model: Optional[bool] = False, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ diff --git a/sempy_labs/GetLakehouseColumns.py b/sempy_labs/GetLakehouseColumns.py index 56807281..1cf5dd46 100644 --- a/sempy_labs/GetLakehouseColumns.py +++ b/sempy_labs/GetLakehouseColumns.py @@ -6,7 +6,9 @@ from .HelperFunctions import resolve_lakehouse_name, format_dax_object_name, resolve_lakehouse_id from .GetLakehouseTables import get_lakehouse_tables from typing import List, Optional, Union +from sempy._utils._log import log +@log def get_lakehouse_columns(lakehouse: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/GetLakehouseTables.py b/sempy_labs/GetLakehouseTables.py index f14f60fa..fdb7b3c1 100644 --- a/sempy_labs/GetLakehouseTables.py +++ b/sempy_labs/GetLakehouseTables.py @@ -8,7 +8,9 @@ from .Guardrails import get_sku_size, get_directlake_guardrails_for_sku from .Lakehouse import lakehouse_attached from typing import List, Optional, Union +from sempy._utils._log import log +@log def get_lakehouse_tables(lakehouse: Optional[str] = None, workspace: Optional[str] = None, extended: Optional[bool] = False, count_rows: Optional[bool] = False, export: Optional[bool] = False): """ diff --git a/sempy_labs/GetMeasureDependencies.py b/sempy_labs/GetMeasureDependencies.py index 6a1ba50d..053e0eae 100644 --- a/sempy_labs/GetMeasureDependencies.py +++ b/sempy_labs/GetMeasureDependencies.py @@ -3,7 +3,9 @@ import pandas as pd from .HelperFunctions import format_dax_object_name from typing import List, Optional, Union +from sempy._utils._log import log +@log def get_measure_dependencies(dataset: str, workspace: Optional[str] = None): """ @@ -75,6 +77,7 @@ def get_measure_dependencies(dataset: str, workspace: Optional[str] = None): return df +@log def get_model_calc_dependencies(dataset: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/Lakehouse.py b/sempy_labs/Lakehouse.py index eb65e010..2bfebb53 100644 --- a/sempy_labs/Lakehouse.py +++ b/sempy_labs/Lakehouse.py @@ -5,6 +5,7 @@ from delta import DeltaTable from .HelperFunctions import resolve_lakehouse_name from typing import List, Optional, Union +from sempy._utils._log import log def lakehouse_attached() -> bool: @@ -28,6 +29,7 @@ def lakehouse_attached() -> bool: else: return False +@log def optimize_lakehouse_tables(tables: Optional[Union[str, List[str]]] = None, lakehouse: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/ListDirectLakeModelCalcTables.py b/sempy_labs/ListDirectLakeModelCalcTables.py index da653d5d..3eac1966 100644 --- a/sempy_labs/ListDirectLakeModelCalcTables.py +++ b/sempy_labs/ListDirectLakeModelCalcTables.py @@ -3,9 +3,9 @@ import pandas as pd from .ListFunctions import list_tables, list_annotations from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def list_direct_lake_model_calc_tables(dataset: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/LogAnalytics.py b/sempy_labs/LogAnalytics.py index 098b4bbe..8b4cacad 100644 --- a/sempy_labs/LogAnalytics.py +++ b/sempy_labs/LogAnalytics.py @@ -3,9 +3,9 @@ import pandas as pd from .HelperFunctions import resolve_dataset_id from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def run_dax(dataset: str, dax_query: str, user_name: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/MeasureDependencyTree.py b/sempy_labs/MeasureDependencyTree.py index ef557e45..17a3b649 100644 --- a/sempy_labs/MeasureDependencyTree.py +++ b/sempy_labs/MeasureDependencyTree.py @@ -3,9 +3,9 @@ from anytree import Node, RenderTree from .GetMeasureDependencies import get_measure_dependencies from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def measure_dependency_tree(dataset: str, measure_name: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrateCalcTablesToLakehouse.py b/sempy_labs/MigrateCalcTablesToLakehouse.py index faeed082..67317272 100644 --- a/sempy_labs/MigrateCalcTablesToLakehouse.py +++ b/sempy_labs/MigrateCalcTablesToLakehouse.py @@ -7,14 +7,14 @@ from .TOM import connect_semantic_model from pyspark.sql import SparkSession from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def migrate_calc_tables_to_lakehouse(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ @@ -178,7 +178,7 @@ def migrate_calc_tables_to_lakehouse(dataset: str, new_dataset: str, workspace: break time.sleep(1) - +@log def migrate_field_parameters(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrateCalcTablesToSemanticModel.py b/sempy_labs/MigrateCalcTablesToSemanticModel.py index c505a3d7..6b7e04cb 100644 --- a/sempy_labs/MigrateCalcTablesToSemanticModel.py +++ b/sempy_labs/MigrateCalcTablesToSemanticModel.py @@ -5,14 +5,14 @@ from .HelperFunctions import resolve_lakehouse_name from .TOM import connect_semantic_model from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def migrate_calc_tables_to_semantic_model(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None ): """ diff --git a/sempy_labs/MigrateModelObjectsToSemanticModel.py b/sempy_labs/MigrateModelObjectsToSemanticModel.py index ad0efabe..aa984255 100644 --- a/sempy_labs/MigrateModelObjectsToSemanticModel.py +++ b/sempy_labs/MigrateModelObjectsToSemanticModel.py @@ -5,14 +5,14 @@ from .HelperFunctions import create_relationship_name from .TOM import connect_semantic_model from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def migrate_model_objects_to_semantic_model(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrateTablesColumnsToSemanticModel.py b/sempy_labs/MigrateTablesColumnsToSemanticModel.py index d6458baa..47f5d054 100644 --- a/sempy_labs/MigrateTablesColumnsToSemanticModel.py +++ b/sempy_labs/MigrateTablesColumnsToSemanticModel.py @@ -8,14 +8,14 @@ from .Lakehouse import lakehouse_attached from .TOM import connect_semantic_model from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def migrate_tables_columns_to_semantic_model(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ diff --git a/sempy_labs/MigrationValidation.py b/sempy_labs/MigrationValidation.py index 48be5b52..150f7f78 100644 --- a/sempy_labs/MigrationValidation.py +++ b/sempy_labs/MigrationValidation.py @@ -4,7 +4,7 @@ from .HelperFunctions import create_relationship_name from .TOM import connect_semantic_model from typing import List, Optional, Union - +from sempy._utils._log import log def list_semantic_model_objects(dataset: str, workspace: Optional[str] = None): @@ -84,7 +84,7 @@ def list_semantic_model_objects(dataset: str, workspace: Optional[str] = None): return df - +@log def migration_validation(dataset: str, new_dataset: str, workspace: Optional[str] = None, new_dataset_workspace: Optional[str] = None): """ diff --git a/sempy_labs/ModelAutoBuild.py b/sempy_labs/ModelAutoBuild.py index 3595e69f..6497061c 100644 --- a/sempy_labs/ModelAutoBuild.py +++ b/sempy_labs/ModelAutoBuild.py @@ -5,9 +5,9 @@ from .CreateBlankSemanticModel import create_blank_semantic_model from .GetSharedExpression import get_shared_expression from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def model_auto_build(dataset: str, file_path: str, workspace: Optional[str] = None, lakehouse: Optional[str] = None, lakehouse_workspace: Optional[str] = None): """ diff --git a/sempy_labs/ModelBPA.py b/sempy_labs/ModelBPA.py index bc77f498..89f2ff97 100644 --- a/sempy_labs/ModelBPA.py +++ b/sempy_labs/ModelBPA.py @@ -10,7 +10,7 @@ from .Lakehouse import lakehouse_attached from .GetLakehouseTables import get_lakehouse_tables from typing import List, Optional, Union - +from sempy._utils._log import log def model_bpa_rules(): @@ -306,7 +306,7 @@ def model_bpa_rules(): return df_rules - +@log 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): """ diff --git a/sempy_labs/OneLakeIntegration.py b/sempy_labs/OneLakeIntegration.py index 575c07ff..cd09c1fc 100644 --- a/sempy_labs/OneLakeIntegration.py +++ b/sempy_labs/OneLakeIntegration.py @@ -2,9 +2,9 @@ import sempy.fabric as fabric import pandas as pd from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def export_model_to_onelake(dataset: str, workspace: Optional[str] = None, destination_lakehouse: Optional[str] = None, destination_workspace: Optional[str] = None): """ diff --git a/sempy_labs/RefreshCalcTables.py b/sempy_labs/RefreshCalcTables.py index 338760b9..010e9a0c 100644 --- a/sempy_labs/RefreshCalcTables.py +++ b/sempy_labs/RefreshCalcTables.py @@ -5,14 +5,14 @@ from pyspark.sql import SparkSession from .TOM import connect_semantic_model from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def refresh_calc_tables(dataset: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/RefreshSemanticModel.py b/sempy_labs/RefreshSemanticModel.py index 6efccbad..599bbb7f 100644 --- a/sempy_labs/RefreshSemanticModel.py +++ b/sempy_labs/RefreshSemanticModel.py @@ -3,14 +3,14 @@ import time from .HelperFunctions import resolve_dataset_id from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def refresh_semantic_model(dataset: str, tables: Optional[Union[str, List[str]]] = None, partitions: Optional[Union[str, List[str]]] = None, refresh_type: Optional[str] = None, retry_count: Optional[int] = 0, apply_refresh_policy: Optional[bool] = True, workspace: Optional[str] = None): """ @@ -99,7 +99,7 @@ def extract_names(partition): print(f"{green_dot} Refresh of the '{dataset}' semantic model within the '{workspace}' workspace is complete.") - +@log def cancel_dataset_refresh(dataset: str, request_id: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/ReportFunctions.py b/sempy_labs/ReportFunctions.py index af4d9d22..e8521438 100644 --- a/sempy_labs/ReportFunctions.py +++ b/sempy_labs/ReportFunctions.py @@ -12,7 +12,7 @@ from .Lakehouse import lakehouse_attached from .HelperFunctions import generate_embedded_filter, resolve_dataset_name, resolve_report_id, resolve_lakehouse_name from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' @@ -136,7 +136,7 @@ def report_dependency_tree(workspace: Optional[str] = None): for pre, _, node in RenderTree(node_dict[workspace]): print(f"{pre}{node.custom_property}'{node.name}'") - +@log def export_report(report: str, export_format: str, file_name: Optional[str] = None, bookmark_name: Optional[str] = None, page_name: Optional[str] = None, visual_name: Optional[str] = None, report_filter: Optional[str] = None, workspace: Optional[str] = None): """ @@ -348,7 +348,7 @@ def export_report(report: str, export_format: str, file_name: Optional[str] = No export_file.write(response.content) print(f"{green_dot} The '{export_format}' export for the '{report}' report within the '{workspace}' workspace has been saved to the following location: '{filePath}'.") - +@log def clone_report(report: str, cloned_report: str, workspace: Optional[str] = None, target_workspace: Optional[str] = None, target_dataset: Optional[str] = None): """ @@ -646,6 +646,7 @@ def list_report_bookmarks(report: str, workspace: Optional[str] = None): except: print(f"The '{report}' report within the '{workspace}' workspace has no bookmarks.") +@log def translate_report_titles(report: str, languages: Union[str,List[str]], workspace: Optional[str] = None): """ diff --git a/sempy_labs/ReportRebind.py b/sempy_labs/ReportRebind.py index 72ee3345..844cc0b1 100644 --- a/sempy_labs/ReportRebind.py +++ b/sempy_labs/ReportRebind.py @@ -2,14 +2,14 @@ import sempy.fabric as fabric from .HelperFunctions import resolve_dataset_id, resolve_report_id from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def report_rebind(report: str, dataset: str, report_workspace: Optional[str] = None, dataset_workspace: Optional[str] = None): """ @@ -60,7 +60,7 @@ def report_rebind(report: str, dataset: str, report_workspace: Optional[str] = N else: print(f"{red_dot} The '{report}' report within the '{report_workspace}' workspace failed to rebind to the '{dataset}' semantic model within the '{dataset_workspace}' workspace.") - +@log def report_rebind_all(dataset: str, new_dataset: str, dataset_workspace: Optional[str] = None, new_dataset_workpace: Optional[str] = None, report_workspace: Optional[str] = None): """ diff --git a/sempy_labs/TOM.py b/sempy_labs/TOM.py index 384cca36..d5a18fff 100644 --- a/sempy_labs/TOM.py +++ b/sempy_labs/TOM.py @@ -9,7 +9,7 @@ from .Fallback import check_fallback_reason from contextlib import contextmanager from typing import List, Optional, Union, TYPE_CHECKING - +from sempy._utils._log import log if TYPE_CHECKING: import Microsoft.AnalysisServices.Tabular @@ -23,7 +23,7 @@ start_bold = '\033[1m' end_bold = '\033[0m' - +@log @contextmanager def connect_semantic_model(dataset: str, readonly: Optional[bool] = True, workspace: Optional[str] = None): diff --git a/sempy_labs/Translations.py b/sempy_labs/Translations.py index cb80eb6b..0f389ce3 100644 --- a/sempy_labs/Translations.py +++ b/sempy_labs/Translations.py @@ -1,6 +1,6 @@ import pandas as pd from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' @@ -42,7 +42,7 @@ def language_validate(language: str): return lang - +@log def translate_semantic_model(dataset: str, languages: Union[str, List[str]], exclude_characters: Optional[str] = None, workspace: Optional[str] = None): """ diff --git a/sempy_labs/Vertipaq.py b/sempy_labs/Vertipaq.py index f59e7bbc..f88e08b3 100644 --- a/sempy_labs/Vertipaq.py +++ b/sempy_labs/Vertipaq.py @@ -9,9 +9,9 @@ from .GetLakehouseTables import get_lakehouse_tables from .Lakehouse import lakehouse_attached from typing import List, Optional, Union +from sempy._utils._log import log - - +@log def vertipaq_analyzer(dataset: str, workspace: Optional[str] = None, export: Optional[str] = None, lakehouse_workspace: Optional[str] = None, read_stats_from_data: Optional[bool] = False): """ @@ -532,7 +532,7 @@ def visualize_vertipaq(dataframes): # Default to open the first tab display(HTML("")) - +@log def import_vertipaq_analyzer(folder_path: str, file_name: str): """ diff --git a/sempy_labs/WarmCache.py b/sempy_labs/WarmCache.py index b1b99d3b..b4d340d0 100644 --- a/sempy_labs/WarmCache.py +++ b/sempy_labs/WarmCache.py @@ -8,14 +8,14 @@ from .RefreshSemanticModel import refresh_semantic_model from .GetMeasureDependencies import get_measure_dependencies from typing import List, Optional, Union - +from sempy._utils._log import log green_dot = '\U0001F7E2' yellow_dot = '\U0001F7E1' red_dot = '\U0001F534' in_progress = '⌛' - +@log def warm_direct_lake_cache_perspective(dataset: str, perspective: str, add_dependencies: Optional[bool] = False, workspace: Optional[str] = None): """ @@ -115,7 +115,7 @@ def warm_direct_lake_cache_perspective(dataset: str, perspective: str, add_depen return df - +@log def warm_direct_lake_cache_isresident(dataset: str, workspace: Optional[str] = None): """ diff --git a/sempy_labs/__init__.py b/sempy_labs/__init__.py index e69de29b..95653de0 100644 --- a/sempy_labs/__init__.py +++ b/sempy_labs/__init__.py @@ -0,0 +1,113 @@ +import sempy +import sempy.fabric as fabric + +from .ListFunctions import list_tables +from .ListFunctions import list_annotations +from .HelperFunctions import format_dax_object_name +from .HelperFunctions import create_relationship_name +from .HelperFunctions import resolve_lakehouse_name +from .HelperFunctions import resolve_lakehouse_id +from .HelperFunctions import resolve_dataset_name +from .HelperFunctions import resolve_dataset_id +from .HelperFunctions import resolve_report_id +from .HelperFunctions import resolve_report_name +from .CreatePQTFile import create_pqt_file +from .CreateBlankSemanticModel import create_blank_semantic_model +from .GetSharedExpression import get_shared_expression +from .MigrateTablesColumnsToSemanticModel import migrate_tables_columns_to_semantic_model +from .MigrateModelObjectsToSemanticModel import migrate_model_objects_to_semantic_model +from .ReportRebind import report_rebind +from .ReportRebind import report_rebind_all +from .RefreshSemanticModel import refresh_semantic_model +from .ShowUnsupportedDirectLakeObjects import show_unsupported_direct_lake_objects +from .GetLakehouseColumns import get_lakehouse_columns +from .GetLakehouseTables import get_lakehouse_tables +from .DirectLakeSchemaCompare import direct_lake_schema_compare +from .MigrateCalcTablesToLakehouse import migrate_calc_tables_to_lakehouse +from .MigrateCalcTablesToLakehouse import migrate_field_parameters +from .RefreshCalcTables import refresh_calc_tables +from .MigrateCalcTablesToSemanticModel import migrate_calc_tables_to_semantic_model +from .UpdateDirectLakeModelLakehouseConnection import update_direct_lake_model_lakehouse_connection +from .ListDirectLakeModelCalcTables import list_direct_lake_model_calc_tables +from .UpdateDirectLakePartitionEntity import update_direct_lake_partition_entity +from .GetDirectLakeLakehouse import get_direct_lake_lakehouse +from .ClearCache import clear_cache +from .Fallback import check_fallback_reason +from .Guardrails import get_direct_lake_guardrails +from .Guardrails import get_sku_size +from .Guardrails import get_directlake_guardrails_for_sku +from .GetMeasureDependencies import get_measure_dependencies +from .MeasureDependencyTree import measure_dependency_tree +from .GetSemanticModelBim import get_semantic_model_bim +from .GenerateSemanticModel import create_semantic_model_from_bim +from .GenerateReport import create_report_from_reportjson +from .WarmCache import warm_direct_lake_cache_perspective +from .WarmCache import warm_direct_lake_cache_isresident +from .Vertipaq import vertipaq_analyzer +from .Vertipaq import import_vertipaq_analyzer +from .Vertipaq import visualize_vertipaq +from .ModelBPA import run_model_bpa +from .DirectLakeSchemaSync import direct_lake_schema_sync +from .HelperFunctions import get_direct_lake_sql_endpoint +from .ReportFunctions import get_report_json +from .ReportFunctions import export_report +from .ReportFunctions import clone_report +from .OneLakeIntegration import export_model_to_onelake +from .Shortcuts import create_shortcut_onelake +from .Shortcuts import delete_shortcut +from .Shortcuts import list_shortcuts +#from .Shortcuts import create_shortcut +from .ReportFunctions import launch_report +from .ListFunctions import list_dashboards +from .RefreshSemanticModel import cancel_dataset_refresh +from .Lakehouse import optimize_lakehouse_tables +from .ListFunctions import list_lakehouses +#from .ListFunctions import list_sqlendpoints +from .ListFunctions import list_warehouses +#from .ListFunctions import list_mirroredwarehouses +#from .ListFunctions import list_kqldatabases +#from .ListFunctions import list_kqlquerysets +#from .ListFunctions import list_eventstreams +#from .ListFunctions import list_datamarts +#from .ListFunctions import list_datapipelines +#from .ListFunctions import list_mlexperiments +#from .ListFunctions import list_mlmodels +from .ListFunctions import update_item +from .ModelBPA import model_bpa_rules +from .ListFunctions import list_relationships +from .ListFunctions import create_warehouse +#from .ReportFunctions import list_report_pages +#from .ReportFunctions import list_report_visuals +#from .ReportFunctions import list_report_bookmarks +#from .ReportFunctions import translate_report_titles +#from .GenerateReport import update_report_from_reportjson +from .Lakehouse import lakehouse_attached +from .Translations import language_validate +#from .GenerateSemanticModel import deploy_semantic_model +#from .AI import generate_aggs +#from .AI import generate_measure_descriptions +#from .ReportFunctions import report_dependency_tree +from .HelperFunctions import create_abfss_path +#from .AI import optimize_semantic_model +from .ListFunctions import list_dataflow_storage_accounts +from .ListFunctions import get_object_level_security +from .Translations import translate_semantic_model +from .HelperFunctions import generate_embedded_filter +from .LogAnalytics import run_dax +from .TOM import connect_semantic_model +#from .ModelAutoBuild import model_auto_build +from .GetMeasureDependencies import get_model_calc_dependencies +from .HelperFunctions import save_as_delta_table +#from .ListFunctions import list_kpis +#from .QSO import list_qso_settings +#from .QSO import qso_sync +#from .QSO import qso_sync_status +#from .QSO import set_qso +#from .QSO import disable_qso +#from .QSO import set_semantic_model_storage_format +#from .QSO import set_workspace_default_storage_format +#from .Connections import create_connection_cloud +#from .Connections import create_connection_on_prem +#from .Connections import create_connection_vnet +from .MigrationValidation import migration_validation +from .MigrationValidation import list_semantic_model_objects \ No newline at end of file diff --git a/sempy_labs/shortcuts.py b/sempy_labs/shortcuts.py index 8a246bff..77b739d4 100644 --- a/sempy_labs/shortcuts.py +++ b/sempy_labs/shortcuts.py @@ -1,4 +1,4 @@ -import sempy_labs +import sempy import sempy.fabric as fabric import pandas as pd from .HelperFunctions import resolve_lakehouse_name, resolve_lakehouse_id From bbae107729071ce4012533f178313ca8839582e2 Mon Sep 17 00:00:00 2001 From: Markus Cozowicz Date: Mon, 17 Jun 2024 08:15:52 +0000 Subject: [PATCH 3/3] don't use numpy 2.0.0 (breaks build) --- docs/requirements.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index ad8b4fa4..38a3b6c1 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,11 @@ -semantic-link-sempy \ No newline at end of file +semantic-link-sempy +sphinx_rtd_theme +pandas==2.0.3 +numpy<2.0.0 # 2.0.0 breaks the build +# pyspark==3.5.0 +azure-identity==1.7.1 +azure-keyvault-secrets +azure-storage-file-datalake==12.3.1 +azure-storage-blob>=12.9.0 +anytree +IPython