rebenitez1802 opened a new pull request, #43829:
URL: https://github.com/apache/superset/pull/43829
### SUMMARY
The **Datasets** list page (`/tablemodelview/list`) has a **Schema** filter,
but selecting a schema had no effect — the list kept showing datasets from
every schema.
The page fetches from the combined `GET /api/v1/datasource/` endpoint
(datasets + semantic views) and sends the schema filter as `{col: "schema",
opr: "eq", value: "<schema>"}`. The endpoint's `_parse_filters` recognized only
`source_type`, `table_name`, `sql`, `database`, and `semantic_layer_uuid` — it
had no `schema` branch and no default, so the filter fell through and was
silently dropped. (The schema dropdown itself is populated from the
dataset-only `/api/v1/dataset/distinct/schema` API, which is why the control
looked functional while the list ignored it.)
This threads a `schema_filter` through the command and DAO:
- `_parse_filters` extracts `schema`/`eq` into a new `schema_filter`.
- `_resolve_source_type` narrows the source type to datasets when a schema
filter is present (semantic views have no schema), while an explicit
`source_type` selection still wins.
- `_build_combined_query` forwards it to
`DatasourceDAO.build_dataset_query`, which applies `WHERE SqlaTable.schema ==
:value` **on top of** the existing `get_dataset_access_filters`.
**Security:** the new predicate is an additional `WHERE` on the dataset
query and is parameter-bound, so it can only *narrow* results, never broaden
access — no change to the role/capability matrix. Behavior matches the
canonical `/api/v1/dataset/` endpoint, which applies the same plain
`FilterEqual` on `schema` (schema matches unscoped across databases/catalogs by
design).
### BEFORE/AFTER
- **Before:** Selecting a schema on the Datasets page returns datasets from
all schemas.
- **After:** The list is restricted to datasets in the selected schema;
semantic views (which have no schema) are excluded from the narrowed result.
### TESTING INSTRUCTIONS
Automated:
- `pytest tests/unit_tests/commands/datasource/list_test.py
tests/unit_tests/dao/datasource_test.py` (schema extraction, source-type
narrowing, boundary values, and a DAO test with a contrasting-schema fixture).
- `pytest tests/integration_tests/datasource/api_tests.py -k
test_combined_list_filters_by_schema` (end-to-end: a unique per-run schema
means the combined result must equal exactly the matching dataset, proving both
the `WHERE` clause and the semantic-view exclusion, independent of pagination).
Manual:
1. On the Datasets page, open the **Schema** filter and pick a schema.
2. Confirm the list now shows only datasets in that schema; clearing the
filter restores the full list.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]