Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert AssetSelection subclasses from NamedTuples to Pydantic (#19197)
## Summary & Motivation This PR updates `AssetSelection` and its subclasses to inherit from `pydantic.BaseModel` instead of `NamedTuple`. `NamedTuple._replace()` was replaced by `AssetSelection.replace()`, a wrapper for `copy` (pydantic v1) and `model_copy` (pydantic v2) After several attempts, to make this work - the super class `AssetSelection` must inherit from `pydantic.BaseModel` - the super class and subclasses must have the config `frozen=True`, which allows all of them to be immutable, like `NamedTuple`. Because of that, this PR udpates: - all classes in `asset_selection.py` to reflect the changes. - the class `DbtManifestAssetSelection` in `dagster-dbt`, which inherits from `AssetSelection`. It is now immutable. - the code using the classes - when inheriting from `pydantic.BaseModel`, instantiating new objects require keyword-only arguments except if `__init__()` is redefined for the class, so the code was updated to use the keywords. - the tests to reflect the changes. ## How I Tested These Changes BK
- Loading branch information