Add per-table suggest_facets configuration option

Allow disabling suggested facets for individual tables by setting
"suggest_facets": false in table configuration. This is useful for
tables where facet suggestions are unhelpful or too expensive, while
keeping them enabled for other tables in the same instance.

https://claude.ai/code/session_01JkWNePDCxMYKcq5qSfMo3r
This commit is contained in:
Claude 2026-02-21 01:02:37 +00:00
commit 1a53bdc793
No known key found for this signature in database
4 changed files with 86 additions and 1 deletions

View file

@ -1002,6 +1002,39 @@ def test_suggest_facets_off():
)
def test_suggest_facets_off_per_table():
with make_app_client(
metadata={
"databases": {
"fixtures": {
"tables": {
"facetable": {"suggest_facets": False},
}
}
}
}
) as client:
# suggested_facets should be [] for the table with suggest_facets: false
assert (
[]
== client.get("/fixtures/facetable.json?_extra=suggested_facets").json[
"suggested_facets"
]
)
# But other tables should still get suggestions
other = client.get(
"/fixtures/simple_primary_key.json?_extra=suggested_facets"
).json["suggested_facets"]
# simple_primary_key has a 'content' column that can be faceted
assert isinstance(other, list)
# Explicit facets should still work even when suggestions are off
response = client.get(
"/fixtures/facetable.json?_facet=state&_extra=suggested_facets"
)
assert response.json["suggested_facets"] == []
assert response.json["facet_results"]["results"] != {}
@pytest.mark.asyncio
@pytest.mark.parametrize("nofacet", (True, False))
async def test_nofacet(ds_client, nofacet):