Edit page in Livemark
(2023-01-25 11:55)

Other Classes

Error

The Error class is a metadata with no behavior. It's used to describe an error that happened during Framework work or during the validation.

To create a custom error you basically just need to fill the required class fields:

from frictionless import errors

class DuplicateRowError(errors.RowError):
    code = "duplicate-row"
    name = "Duplicate Row"
    tags = ["#table", "#row", "#duplicate"]
    template = "Row at position {rowPosition} is duplicated: {note}"
    description = "The row is duplicated."

Stats

The Stats represent various describe/validate stats:

from frictionless import describe

resource = describe('table.csv', stats=True)
print(resource.stats)
{'md5': '6c2c61dd9b0e9c6876139a449ed87933',
 'sha256': 'a1fd6c5ff3494f697874deeb07f69f8667e903dd94a7bc062dd57550cea26da8',
 'bytes': 30,
 'fields': 2,
 'rows': 2}

Reference

Error (class)

Stats (class)

Error (class)

Error representation. It is a baseclass from which other subclasses of errors are inherited or derived from.

Signature

(*, note: str) -> None

Parameters

  • note (str)

error.type (property)

A human readable informative comprehensive description of the error. It can be set to any custom text. If not set, default description is more comprehensive with error type, message and reasons included.

Signature

ClassVar[str]

error.title (property)

A human readable informative comprehensive description of the error. It can be set to any custom text. If not set, default description is more comprehensive with error type, message and reasons included.

Signature

ClassVar[str]

error.description (property)

A human readable informative comprehensive description of the error. It can be set to any custom text. If not set, default description is more comprehensive with error type, message and reasons included.

Signature

ClassVar[str]

error.template (property)

A human readable informative comprehensive description of the error. It can be set to any custom text. If not set, default description is more comprehensive with error type, message and reasons included.

Signature

ClassVar[str]

error.tags (property)

A human readable informative comprehensive description of the error. It can be set to any custom text. If not set, default description is more comprehensive with error type, message and reasons included.

Signature

ClassVar[List[str]]

error.message (property)

A human readable informative comprehensive description of the error. It can be set to any custom text. If not set, default description is more comprehensive with error type, message and reasons included.

Signature

str

error.note (property)

A short human readable description of the error. It can be set to any custom text.

Signature

str

Stats (class)

Stats representation This class stores stats of the validation task.

Signature

(*, md5: Optional[str] = None, sha256: Optional[str] = None, bytes: Optional[int] = None, fields: Optional[int] = None, rows: Optional[int] = None, tasks: Optional[int] = None, warnings: Optional[int] = None, errors: Optional[int] = None, seconds: Optional[float] = None) -> None

Parameters

  • md5 (Optional[str])
  • sha256 (Optional[str])
  • bytes (Optional[int])
  • fields (Optional[int])
  • rows (Optional[int])
  • tasks (Optional[int])
  • warnings (Optional[int])
  • errors (Optional[int])
  • seconds (Optional[float])

stats.md5 (property)

Hashed value of data with md5 hashing algorithm.

Signature

Optional[str]

stats.sha256 (property)

Hashed value of data with sha256 hashing algorithm.

Signature

Optional[str]

stats.bytes (property)

Size of data in bytes.

Signature

Optional[int]

stats.fields (property)

Number of fields in a resource.

Signature

Optional[int]

stats.rows (property)

Number of rows in a resource.

Signature

Optional[int]

stats.tasks (property)

Number of resource to validate.

Signature

Optional[int]

stats.warnings (property)

Number of warnings from the validation task. Warnings are information to users about non severe problems such as "limits reached".

Signature

Optional[int]

stats.errors (property)

Number of errors from the validation task.

Signature

Optional[int]

stats.seconds (property)

Time taken in secs to validate a resource.

Signature

Optional[float]