diff --git a/frictionless/resource/factory.py b/frictionless/resource/factory.py index dd6867ce10..82472c9c2d 100644 --- a/frictionless/resource/factory.py +++ b/frictionless/resource/factory.py @@ -45,10 +45,16 @@ def __call__( path = source if isinstance(source, str): path = helpers.join_basepath(source, basepath=basepath) - md_type = Detector.detect_metadata_type(path, format=options.get("format")) + md_type = options.get("datatype") + if not md_type: + md_type = Detector.detect_metadata_type( + path, format=options.get("format") + ) if md_type != "resource": options["path" if isinstance(source, str) else "data"] = source - resource = cls(control=control, basepath=basepath, **options) # type: ignore + resource = cls( # type: ignore + control=control, basepath=basepath, **options + ) return cast(T, resource) # Descriptor