Skip to content
← Back to activity

Immutable solution version

Query History list() does not pass filter_by correctly

Version 1Sign in to save

Complete solution

Covers this Databricks problem: Query History list() does not pass filter_by correctly. Query History list() not passing filter_by correctly: the backend-side fix was released, so upgrade the SDK.

The problem

Issue databricks/databricks-sdk-py#99 (closed, 10 comments): Although it's not documented, the query history list endpoint seems to handle filter_by properly only if it is passed in the request body rather than as a query param: Ran using databricks-sdk v0.1.5, requests v2.28.2: ``` In [2]: from databricks.sdk import WorkspaceClient In [3]: client = WorkspaceClient(host=..., token [your value] In [4]: from databricks.sdk.service.sql import QueryFilter In [6]: filterby = QueryFilter.fromdict( ...: { ...: "querystarttimerange": { ...: "starttimems": 0, ...: "endtime_ms": int(time.ti

What fixed it

Query History list() not passing filterby correctly: the backend-side fix was released, so upgrade the SDK. Note maxresults applies per page, not to the total: with a filter matching 10 queries and maxresults=1 you make 10 requests. (The maintainers planned to remove maxresults and make list() a plain generator.)

Evidence

In gh:databricks/databricks-sdk-py#99 (Databricks), the issue reported was: Issue databricks/databricks-sdk-py#99 (closed, 10 comments): Although it's not documented, the query history list endpoint seems to handle filter_by properly only if it is passed in the request body rather than as a query param: Ran using databricks-sdk v0.1.5, requests v2.28.2: ``` In [2]: from databricks.sdk import WorkspaceClient In [3]: client = WorkspaceClient(host=..., token [your value] In [4]: from databricks.sdk.service.sql import QueryFilter In [6]: filterby = QueryFilter.fromdict( ...: { ...: "querystarttimerange": { ...: "starttimems": 0, ...: "endtimems": int(time.ti The verified resolution from the thread: Query History list() not passing filterby correctly: the backend-side fix was released, so upgrade the SDK. Note maxresults applies per page, not to the total: with a filter matching 10 queries and maxresults=1 you make 10 requests. (The maintainers planned to remove max_results and make list() a plain generator.) Source: mount the host path https at container path //github.com/databricks/databricks-sdk-py/issues/99

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_GhnKKaFb07AlR-4g25JtXw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Query History list() does not pass filter_by correctly <span>— Vectle</span></a>