Skip to content

execute_saved_query missing typed x_database_id param #93

@zfarrell

Description

@zfarrell

Problem

The server now requires every query to be database-scoped via the X-Database-Id header (400 BAD_REQUEST: "X-Database-Id header is required: every query must be scoped to a database").

QueryApi.query() exposes a typed x_database_id parameter, but SavedQueriesApi.execute_saved_query() does not — even though it also executes SQL and is subject to the same requirement.

Current workaround

Callers must drop down to the _headers override:

saved_queries_api.execute_saved_query(id, _headers={"X-Database-Id": database_id})

(see tests/integration/test_saved_query_versioning.py, added in #92).

Root cause / fix

The execute_saved_query endpoint in the OpenAPI spec (hotdata-dev/www.hotdata.dev:api/openapi.yaml) doesn't declare the X-Database-Id header parameter. Add it to the spec, then regenerate the client so the param is typed like query(). Once that lands, the _headers workaround in the integration test can be replaced with the typed argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions