diff --git a/pyproject.toml b/pyproject.toml index 7ed11e4..e39a4e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "python_tabular" -version = "0.2.1" +version = "0.2.2" authors = [ { name="Curtis Stallings", email="curtisrstallings@gmail.com" }, ] diff --git a/pytabular/pytabular.py b/pytabular/pytabular.py index 61922ba..ab05f49 100644 --- a/pytabular/pytabular.py +++ b/pytabular/pytabular.py @@ -75,6 +75,7 @@ def __init__(self, CONNECTION_STR: str): logger.info(f"Connected to Model - {self.Model.Name}") self.Adomd: Connection = Connection(self.Server) self.Effective_Users = dict() + self.PyRefresh = PyRefresh # Build PyObjects self.Reload_Model_Info() @@ -161,8 +162,7 @@ def Refresh(self, *args, **kwargs) -> pd.DataFrame: Returns: pd.DataFrame """ - r = PyRefresh(self, *args, **kwargs) - return r.Run() + return self.PyRefresh(self, *args, **kwargs).Run() def Update(self, UpdateOptions: UpdateOptions = UpdateOptions.ExpandFull) -> None: """[Update Model](https://docs.microsoft.com/en-us/dotnet/api/microsoft.analysisservices.majorobject.update?view=analysisservices-dotnet#microsoft-analysisservices-majorobject-update(microsoft-analysisservices-updateoptions)) diff --git a/pytabular/query.py b/pytabular/query.py index 7c2b764..f61faf3 100644 --- a/pytabular/query.py +++ b/pytabular/query.py @@ -42,7 +42,7 @@ def Query(self, Query_Str: str) -> Union[pd.DataFrame, str, int]: is_file = False if is_file: - logging.debug( + logger.debug( f"File path detected, reading file... -> {Query_Str}", ) with open(Query_Str, "r") as file: diff --git a/pytabular/refresh.py b/pytabular/refresh.py index bd852cd..e643d91 100644 --- a/pytabular/refresh.py +++ b/pytabular/refresh.py @@ -150,6 +150,12 @@ def __iter__(self): def add_refresh_check(self, refresh_check: Refresh_Check): self._refresh_checks.append(refresh_check) + def remove_refresh_check(self, refresh_check: Refresh_Check): + self._refresh_checks.remove(refresh_check) + + def clear_refresh_checks(self): + self._refresh_checks.clear() + class PyRefresh: def __init__( @@ -217,6 +223,7 @@ def _post_checks(self): self.trace.Drop() for check in self._checks: check.Post_Check() + self._checks.remove_refresh_check(check) pass def _get_trace(self) -> Base_Trace: diff --git a/test/test_tabular.py b/test/test_tabular.py index 79e02d8..0ef4c2e 100644 --- a/test/test_tabular.py +++ b/test/test_tabular.py @@ -6,7 +6,7 @@ aas = pytabular.Tabular(local.AAS) gen2 = pytabular.Tabular(local.GEN2) -testing_parameters = [(aas), (gen2)] +testing_parameters = [pytest.param(aas, id="AAS"), pytest.param(gen2, id="GEN2")] testingtablename = "PyTestTable" testingtabledf = pd.DataFrame(data={"col1": [1, 2, 3], "col2": ["four", "five", "six"]})