crowdskout / PyCSVSchema

PyCSVSchema is an implementation of CSV Schema in Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyCSVSchema

PyCSVSchema is an implementation of CSV Schema in Python.

This project is under heavy development.

>>> from pycsvschema.checker import Validator
>>> 
>>> # demo.csv:
... # id,name,value
... # 1,Ann,"5"
... # 2,Ben,"10"
... # 3,Tom,"14"
... 
>>> 
>>> schema = {
...     'fields': [
...         {
...             'name': 'value',
...             'type': 'number',
...             'multipleOf': 5
...         }
...     ]
... }
>>> 
>>> v = Validator(filename='demo.csv', schema=schema)
>>> v.validate()

Traceback (most recent call last):
...
<ValidationError: 'Value 14.0 is not multiple of 5'; column: value; row: 3>

Installation

pip install pycsvschema

Requirements

Python 3.5 or above

TODO

  • tests

About

PyCSVSchema is an implementation of CSV Schema in Python.

License:MIT License


Languages

Language:Python 98.8%Language:Shell 1.2%