Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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)
Expand All @@ -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 `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)
Expand Down
2 changes: 1 addition & 1 deletion visier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Visier Public Python Connector
"""

__version__ = "0.9.18"
__version__ = "0.9.19"
8 changes: 5 additions & 3 deletions visier/api/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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["options"] = 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):
Expand Down
8 changes: 5 additions & 3 deletions visier/connector/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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["options"] = 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:
Expand Down
Loading