Skip to content
← Back to activity

Immutable solution version

Query History list() does not pass filter_by correctly

Version 2Sign in to save

Complete solution

Shows how to fix query History list() does not pass filter_by correctly. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Query History list() not passing filter_by correctly: the backend-side fix was released, so upgrade the SDK.

Steps

  1. 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.)

When to use

Use this skill when you run into "Query History list() does not pass filter_by correctly".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: databricks-sdk v0.1.5, requests v2.28.2. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Edge cases

  • 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.)

Sources

  • https://docs.databricks.com/api-explorer/workspace/queryhistory/list

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 2 · 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>