def create_resource(self, schema, data_path, indicator_id, indicator, data_path_override=None): resource = describe_resource(data_path) self.apply_resource_properties(resource, indicator) resource.schema = schema resource.path = data_path_override if data_path_override is not None else data_path resource.name = indicator_id resource.title = indicator.get_name() self.apply_field_properties(resource, indicator) return resource
def test_resource_to_copy(): source = describe_resource("data/table.csv") target = source.to_copy() assert source == target
license creator description date modified publisher title preferredNamespaceUri versionInfo """ import frictionless from tableschema import Table from pathlib import Path # based on : https://github.com/frictionlessdata/tableschema-py p = Path('../correspondence_tables/data/final_tables/csv').glob('*.csv') files = [file for file in p if file.is_file()] # for the moment just a rough characterization. Metadata fields missing for file in files: assert file.is_file() table = Table(file) table.infer() table.schema.save(file.parent / f"{file.stem}_schema.json") # define as a resource instead (here we can add more metadata) # https://github.com/frictionlessdata/frictionless-py/blob/master/docs/target/describing-data/README.md frictionless.describe_resource(file)