feat(scan): enforce table scope at fetch boundary

This commit is contained in:
Andrey Avtomonov 2026-05-22 18:36:53 +02:00
parent a698389bc9
commit 5b8292cacd
19 changed files with 208 additions and 160 deletions

View file

@ -5,7 +5,9 @@ import pytest
from ktx_daemon.database_introspection import (
DatabaseIntrospectionRequest,
DatabaseIntrospectionRows,
LiveDatabaseTableScopeRef,
_statement_timeout_config,
_table_scope_json,
introspect_database_response,
)
@ -146,6 +148,22 @@ def test_database_introspection_request_rejects_empty_schema_list() -> None:
)
def test_table_scope_json_serializes_null_wildcards() -> None:
assert _table_scope_json(
[
LiveDatabaseTableScopeRef(catalog=None, db="public", name="orders"),
LiveDatabaseTableScopeRef(
catalog="warehouse",
db="marts",
name="customers",
),
]
) == (
'[{"catalog": null, "db": "public", "name": "orders"}, '
'{"catalog": "warehouse", "db": "marts", "name": "customers"}]'
)
def test_statement_timeout_config_uses_parameterized_set_config() -> None:
assert _statement_timeout_config(30_000) == (
"SELECT set_config('statement_timeout', %s, true)",