hussein-awala opened a new pull request, #74498:
URL: https://github.com/apache/airflow/pull/74498
## Summary
Add `--asset-ids` to `airflow db clean`, following the existing Dag-ID
filtering pattern:
```bash
airflow db clean \
--tables asset_event \
--asset-ids 1,2 \
--clean-before-timestamp '2024-01-01T00:00:00+00:00' \
--dry-run
```
Administrators can apply different event-retention policies to individual
assets without cleaning every asset's history.
- Accept a comma-separated list of positive integer IDs, with whitespace
trimming and validation.
- Require an explicit `--tables asset_event` selection. Omitted, mixed, or
unrelated table selections fail before cleanup.
- Apply the IDs as a request-local predicate through the existing cleanup
query. Timestamp and existing Dag filters still apply.
- Include the selected IDs in confirmation and dry-run output.
- Preserve current archive, skip-archive, batch, transaction, and automatic
cascade behavior. An explicit empty programmatic selection matches no events;
omitting the option leaves existing behavior unchanged.
The diff is limited to CLI option/forwarding, request-local cleanup
configuration, focused tests, and a short documentation example. It adds no new
deletion engine, REST behavior, migrations, dependencies, or queue-deletion
policy.
## Validation
- **26 new cases**, all passing on SQLite and PostgreSQL.
- Full DB command/cleanup test files: **256 passed, 3 skipped on SQLite**;
**258 passed, 1 skipped on PostgreSQL**. Skips are existing backend-specific
cases. The SQLite suite also passed after rebasing onto current `main`.
- Coverage includes parsing/forwarding, invalid and empty inputs,
fail-closed table selection, asset/cutoff scoping, Dag-filter intersections,
dry runs, archive/skip-archive, batching, FK cascades, preserved parents, and
request-local filter state.
- Regular and manual prek checks passed, including core mypy; documentation
build and spelling checks passed.
- Independent review found no actionable defects. `git range-diff` confirmed
the patch was unchanged by the rebase.
### Broader verification note
The database suite selected by `breeze verify` passed. The post-rebase
non-database run reported **4,813 passed, 11 skipped, 2 xfailed, and 2
failures** in the unchanged
`test_the_runtime_inherits_only_its_standard_streams[fork/spawn]` language-SDK
tests.
Both failures were reproduced on a clean worktree at the original upstream
base (`86ebf1c8a2`) with the matching Breeze non-database harness. They report
an unexpected `/usr/bin/dash` file descriptor. No unrelated test or runtime
code was changed to hide these baseline/local-environment failures. MySQL was
not exercised.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Pi 0.84.3
Generated-by: Pi 0.84.3 following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
---
Drafted-by: Pi 0.84.3 (no human review before posting)
--
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]