csvw.frictionless

Functionality to convert tabular data in Frictionless Data Packages to CSVW.

We translate [table schemas](https://specs.frictionlessdata.io/table-schema/) defined for [data resources](https://specs.frictionlessdata.io/data-resource/) in a [data package](https://specs.frictionlessdata.io/data-package/) to a CVSW TableGroup.

This functionality can be used together with the frictionless describe command to add CSVW metadata to “raw” CSV tables.

csvw.frictionless.convert_column_spec(spec)[source]

https://specs.frictionlessdata.io/table-schema/#field-descriptors

Parameters:

spec

Returns:

csvw.frictionless.convert_dialect(rsc)[source]

Limitations: lineTerminator is not supported.

https://specs.frictionlessdata.io/csv-dialect/

csvw.frictionless.convert_foreignKey(rsc_name, fk, resource_map)[source]

https://specs.frictionlessdata.io/table-schema/#foreign-keys

csvw.frictionless.convert_table_schema(rsc_name, schema, resource_map)[source]
Parameters:
  • rsc_namename property of the resource the schema belongs to. Needed to resolve self-referential foreign keys.

  • schemadict parsed from JSON representing a frictionless Table Schema object.

  • resource_mapdict mapping resource names to resource paths, needed to convert foreign key constraints.

Returns:

dict suitable for instantiating a csvw.metadata.Schema object.