diff --git a/frictionless/resource/resource.py b/frictionless/resource/resource.py index 72e11b6e8a..3b3e32af36 100644 --- a/frictionless/resource/resource.py +++ b/frictionless/resource/resource.py @@ -419,6 +419,23 @@ def open(self): raise return self + # Convert + + @classmethod + def from_descriptor( # type: ignore + cls, + descriptor: Union[types.IDescriptor, str], + *, + datatype: Optional[str] = None, + **options: Any, + ) -> Self: + if datatype: + cls = system.select_resource_class(datatype=datatype) + self = cls.from_descriptor(descriptor, **options) + self.datatype = datatype + return self + return super().from_descriptor(descriptor, **options) + # Read # TODO: deprecate in favour of fileResource.read_file