From 2020e41f38bb13038598fa5e84196a649f9a56f0 Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Wed, 23 Nov 2022 11:06:16 -0600 Subject: [PATCH 1/5] logger bug --- pytabular/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From b9751e81e128428bff960b81d9b56940ef47058d Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Wed, 23 Nov 2022 11:49:01 -0600 Subject: [PATCH 2/5] refresh collection bug fix --- pytabular/pytabular.py | 4 ++-- pytabular/refresh.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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/refresh.py b/pytabular/refresh.py index bd852cd..d54482a 100644 --- a/pytabular/refresh.py +++ b/pytabular/refresh.py @@ -149,6 +149,10 @@ 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: @@ -197,11 +201,9 @@ def _pre_checks(self): for refresh_dict in self._objects_to_refresh for table in refresh_dict.keys() ] - def row_count_assertion(pre, post): post = 0 if post is None else post return post > 0 - for table in set(tables): check = Refresh_Check( f"{table.Name} Row Count", table.Row_Count, row_count_assertion @@ -217,6 +219,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: From 28c5d07fa187c8dbb0fa0c94a1476a54c024723d Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Wed, 23 Nov 2022 11:49:22 -0600 Subject: [PATCH 3/5] 0.2.2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" }, ] From faec75d3f7234b8f7d5a4a9168df90c41ef3a26a Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Wed, 23 Nov 2022 12:25:29 -0600 Subject: [PATCH 4/5] black styling --- pytabular/refresh.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytabular/refresh.py b/pytabular/refresh.py index d54482a..e643d91 100644 --- a/pytabular/refresh.py +++ b/pytabular/refresh.py @@ -149,8 +149,10 @@ 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() @@ -201,9 +203,11 @@ def _pre_checks(self): for refresh_dict in self._objects_to_refresh for table in refresh_dict.keys() ] + def row_count_assertion(pre, post): post = 0 if post is None else post return post > 0 + for table in set(tables): check = Refresh_Check( f"{table.Name} Row Count", table.Row_Count, row_count_assertion From d425943d6ddd1462185d62867222c9fcc4404189 Mon Sep 17 00:00:00 2001 From: Curtis Stallings Date: Wed, 23 Nov 2022 12:25:40 -0600 Subject: [PATCH 5/5] param for gen2 aas --- test/test_tabular.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"]})