From d5366c47a5b1d21badc76e353b7f0ab2215b3689 Mon Sep 17 00:00:00 2001 From: Mars Wang Date: Fri, 8 May 2026 12:13:57 +0100 Subject: [PATCH 1/5] update sql-like query to use aggregateQueryOptions over options --- README.md | 2 +- visier/api/query.py | 6 +++--- visier/connector/sessions.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9d79ae3..8726875 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,7 @@ with VisierSession(auth) as s: ``` #### SQL-Like Aggregate Query -In this example, we define a snippet to aggregate `employeeCount` by `Location_0`, `Gender`, `Union_Status`, and `Location_1` for 4 periods of 3 months each starting from April 1, 2020. In aggregate SQL-like queries, you can use `options` to eliminate cells with zero and null values. This reduces the size of the overall result set to only include rows whose metric value is more than 0. +In this example, we define a snippet to aggregate `employeeCount` by `Location_0`, `Gender`, `Union_Status`, and `Location_1` for 4 periods of 3 months each starting from April 1, 2020. In aggregate SQL-like queries, you can use `aggregateQueryOptions` to eliminate cells with zero and null values. This reduces the size of the overall result set to only include rows whose metric value is more than 0. ```python with VisierSession(auth) as s: client = QueryApiClient(s) diff --git a/visier/api/query.py b/visier/api/query.py index ea6ab76..d4556c0 100644 --- a/visier/api/query.py +++ b/visier/api/query.py @@ -36,11 +36,11 @@ def snapshot(self, query_def: object): """Execute a Visier snapshot query and return a tabular result.""" return self._execute_query_api("/v1/data/query/snapshot", query_def) - def sqllike(self, sql_query: str, options = None): + def sqllike(self, sql_query: str, aggregate_query_options = None): """Execute a Visier SQL-like query statement and return a tabular result.""" body = {"query" : sql_query} - if options: - body["options"] = options + if aggregate_query_options: + body["aggregateQueryOptions"] = aggregate_query_options return self._execute_query_api("/v1/data/query/sql", body) def _execute_query_api(self, path: str, body: object): diff --git a/visier/connector/sessions.py b/visier/connector/sessions.py index 69fefe9..09c31b9 100644 --- a/visier/connector/sessions.py +++ b/visier/connector/sessions.py @@ -116,11 +116,11 @@ def execute_list(self, query_def: object): return self._execute_query_api("/v1/data/query/list", query_def) @deprecated(version="0.9.5", reason="Use visier.api.QueryApiClient instead") - def execute_sqllike(self, sql_query: str, options = None): + def execute_sqllike(self, sql_query: str, aggregate_query_options = None): """Execute a Visier SQL-like query statement and return a tabular result.""" body = {"query" : sql_query} - if options: - body["options"] = options + if aggregate_query_options: + body["aggregateQueryOptions"] = aggregate_query_options return self._execute_query_api("/v1/data/query/sql", body) def execute(self, call_function: Callable[[SessionContext], Response]) -> Response: From 7576f981e09b8c63e6fc30ffde7fe820f7e4b5f2 Mon Sep 17 00:00:00 2001 From: Mars Wang Date: Fri, 8 May 2026 12:15:04 +0100 Subject: [PATCH 2/5] avoid changing param name --- visier/api/query.py | 6 +++--- visier/connector/sessions.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/visier/api/query.py b/visier/api/query.py index d4556c0..d5fac39 100644 --- a/visier/api/query.py +++ b/visier/api/query.py @@ -36,11 +36,11 @@ def snapshot(self, query_def: object): """Execute a Visier snapshot query and return a tabular result.""" return self._execute_query_api("/v1/data/query/snapshot", query_def) - def sqllike(self, sql_query: str, aggregate_query_options = None): + def sqllike(self, sql_query: str, options = None): """Execute a Visier SQL-like query statement and return a tabular result.""" body = {"query" : sql_query} - if aggregate_query_options: - body["aggregateQueryOptions"] = aggregate_query_options + if options: + body["aggregateQueryOptions"] = options return self._execute_query_api("/v1/data/query/sql", body) def _execute_query_api(self, path: str, body: object): diff --git a/visier/connector/sessions.py b/visier/connector/sessions.py index 09c31b9..b9d1156 100644 --- a/visier/connector/sessions.py +++ b/visier/connector/sessions.py @@ -116,11 +116,11 @@ def execute_list(self, query_def: object): return self._execute_query_api("/v1/data/query/list", query_def) @deprecated(version="0.9.5", reason="Use visier.api.QueryApiClient instead") - def execute_sqllike(self, sql_query: str, aggregate_query_options = None): + def execute_sqllike(self, sql_query: str, options = None): """Execute a Visier SQL-like query statement and return a tabular result.""" body = {"query" : sql_query} - if aggregate_query_options: - body["aggregateQueryOptions"] = aggregate_query_options + if options: + body["aggregateQueryOptions"] = options return self._execute_query_api("/v1/data/query/sql", body) def execute(self, call_function: Callable[[SessionContext], Response]) -> Response: From 3bb37487272feb79043b44541425cb086f722772 Mon Sep 17 00:00:00 2001 From: Mars Wang Date: Fri, 8 May 2026 12:24:07 +0100 Subject: [PATCH 3/5] support list query options for sql-like --- README.md | 4 ++-- visier/api/query.py | 8 +++++--- visier/connector/sessions.py | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8726875..5fca4f2 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ with VisierSession(auth) as s: You can write SQL-like queries to define both list and aggregate queries. #### SQL-Like List Query -In this example, we define a snippet to get the `EmployeeID`, `Union_Status`, `Direct_Manager.Gender`, `Direct_Manager.Vaccination_Status` where `isFemale` = `TRUE` and `isHighPerformer` = `TRUE` between January 1, 2020 and December 31, 2021. +In this example, we define a snippet to get the `EmployeeID`, `Union_Status`, `Direct_Manager.Gender`, `Direct_Manager.Vaccination_Status` where `isFemale` = `TRUE` and `isHighPerformer` = `TRUE` between January 1, 2020 and December 31, 2021. In list SQL-like queries, you can use `list_query_options`, see [Visier documentation](https://docs.visier.com/developer/apis/references/api-reference.htm#tag/DataQuery/operation/DataQuery_SqlLike) for all available list options. ```python with VisierSession(auth) as s: client = QueryApiClient(s) @@ -261,7 +261,7 @@ with VisierSession(auth) as s: ``` #### SQL-Like Aggregate Query -In this example, we define a snippet to aggregate `employeeCount` by `Location_0`, `Gender`, `Union_Status`, and `Location_1` for 4 periods of 3 months each starting from April 1, 2020. In aggregate SQL-like queries, you can use `aggregateQueryOptions` to eliminate cells with zero and null values. This reduces the size of the overall result set to only include rows whose metric value is more than 0. +In this example, we define a snippet to aggregate `employeeCount` by `Location_0`, `Gender`, `Union_Status`, and `Location_1` for 4 periods of 3 months each starting from April 1, 2020. In aggregate SQL-like queries, you can use `aggregate_query_options` to eliminate cells with zero and null values. This reduces the size of the overall result set to only include rows whose metric value is more than 0. See [Visier documentation](https://docs.visier.com/developer/apis/references/api-reference.htm#tag/DataQuery/operation/DataQuery_SqlLike) for all available aggregate options. ```python with VisierSession(auth) as s: client = QueryApiClient(s) diff --git a/visier/api/query.py b/visier/api/query.py index d5fac39..d1a95af 100644 --- a/visier/api/query.py +++ b/visier/api/query.py @@ -36,11 +36,13 @@ def snapshot(self, query_def: object): """Execute a Visier snapshot query and return a tabular result.""" return self._execute_query_api("/v1/data/query/snapshot", query_def) - def sqllike(self, sql_query: str, options = None): + def sqllike(self, sql_query: str, aggregate_query_options = None, list_query_options = None): """Execute a Visier SQL-like query statement and return a tabular result.""" body = {"query" : sql_query} - if options: - body["aggregateQueryOptions"] = options + if aggregate_query_options: + body["aggregateQueryOptions"] = aggregate_query_options + if list_query_options: + body["listQueryOptions"] = list_query_options return self._execute_query_api("/v1/data/query/sql", body) def _execute_query_api(self, path: str, body: object): diff --git a/visier/connector/sessions.py b/visier/connector/sessions.py index b9d1156..30cd685 100644 --- a/visier/connector/sessions.py +++ b/visier/connector/sessions.py @@ -116,11 +116,13 @@ def execute_list(self, query_def: object): return self._execute_query_api("/v1/data/query/list", query_def) @deprecated(version="0.9.5", reason="Use visier.api.QueryApiClient instead") - def execute_sqllike(self, sql_query: str, options = None): + def execute_sqllike(self, sql_query: str, aggregate_query_options = None, list_query_options = None): """Execute a Visier SQL-like query statement and return a tabular result.""" body = {"query" : sql_query} - if options: - body["aggregateQueryOptions"] = options + if aggregate_query_options: + body["aggregateQueryOptions"] = aggregate_query_options + if list_query_options: + body["listQueryOptions"] = list_query_options return self._execute_query_api("/v1/data/query/sql", body) def execute(self, call_function: Callable[[SessionContext], Response]) -> Response: From 1af1e854ad0969aac51af90ee10741e1799afee0 Mon Sep 17 00:00:00 2001 From: Mars Wang Date: Fri, 8 May 2026 15:17:32 +0100 Subject: [PATCH 4/5] update version to 0.9.19 --- visier/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visier/__init__.py b/visier/__init__.py index ee503bb..6de51ea 100644 --- a/visier/__init__.py +++ b/visier/__init__.py @@ -16,4 +16,4 @@ Visier Public Python Connector """ -__version__ = "0.9.18" +__version__ = "0.9.19" From c21ac5e242e2843da11a6a96bf4d3c1e1caa5fb1 Mon Sep 17 00:00:00 2001 From: Mars Wang Date: Fri, 8 May 2026 17:38:21 +0100 Subject: [PATCH 5/5] address comments --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5fca4f2..bb48d91 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ with VisierSession(auth) as s: You can write SQL-like queries to define both list and aggregate queries. #### SQL-Like List Query -In this example, we define a snippet to get the `EmployeeID`, `Union_Status`, `Direct_Manager.Gender`, `Direct_Manager.Vaccination_Status` where `isFemale` = `TRUE` and `isHighPerformer` = `TRUE` between January 1, 2020 and December 31, 2021. In list SQL-like queries, you can use `list_query_options`, see [Visier documentation](https://docs.visier.com/developer/apis/references/api-reference.htm#tag/DataQuery/operation/DataQuery_SqlLike) for all available list options. +In this example, we define a snippet to get the `EmployeeID`, `Union_Status`, `Direct_Manager.Gender`, `Direct_Manager.Vaccination_Status` where `isFemale` = `TRUE` and `isHighPerformer` = `TRUE` between January 1, 2020 and December 31, 2021. For more information about the available list options, see [Query aggregate or list data using SQL-like syntax](https://docs.visier.com/developer/apis/references/api-reference.htm#tag/DataQuery/operation/DataQuery_SqlLike). ```python with VisierSession(auth) as s: client = QueryApiClient(s) @@ -261,7 +261,7 @@ with VisierSession(auth) as s: ``` #### SQL-Like Aggregate Query -In this example, we define a snippet to aggregate `employeeCount` by `Location_0`, `Gender`, `Union_Status`, and `Location_1` for 4 periods of 3 months each starting from April 1, 2020. In aggregate SQL-like queries, you can use `aggregate_query_options` to eliminate cells with zero and null values. This reduces the size of the overall result set to only include rows whose metric value is more than 0. See [Visier documentation](https://docs.visier.com/developer/apis/references/api-reference.htm#tag/DataQuery/operation/DataQuery_SqlLike) for all available aggregate options. +In this example, we define a snippet to aggregate `employeeCount` by `Location_0`, `Gender`, `Union_Status`, and `Location_1` for 4 periods of 3 months each starting from April 1, 2020. In aggregate SQL-like queries, you can use `aggregate_query_options` to eliminate cells with zero and null values. This reduces the size of the overall result set to only include rows whose metric value is more than 0. For more information about the available aggregate options, see [Query aggregate or list data using SQL-like syntax](https://docs.visier.com/developer/apis/references/api-reference.htm#tag/DataQuery/operation/DataQuery_SqlLike). ```python with VisierSession(auth) as s: client = QueryApiClient(s)