csvschemavalidation is an implementation of CSV Schema in Python.
Project description
csvschemavalidation
csvschemavalidation is an implementation of CSV Schema in Python.
This project is at Alpha version and still under heavy development.
Example
>>> from csvschemavalidation.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(csvfile='demo.csv', schema=schema)
>>> v.validate()
Traceback (most recent call last):
...
<ValidationError: 'Value 14.0 is not multiple of 5'; column name: value; row number: 3>
Note that the validator does not check if the CSV format fits the dialect defined in schema correctly. For example, if wrong delimiter present in schema, validator might read the whole line as one cell.
Installation
pip install csvschemavalidation
Requirements
Python 3.5 or above
TODO
- Documentation and Examples
- Optional header
- Decide whether to rely on Python's built-in int and float function to convert values
- Tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
csvschemavalidation-0.0.8.tar.gz
(14.0 kB
view details)
Built Distribution
File details
Details for the file csvschemavalidation-0.0.8.tar.gz
.
File metadata
- Download URL: csvschemavalidation-0.0.8.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9d806043a7fbbf741aa08c4b0e868d175e5e68299e9dd6fbecfda8b30217b8f |
|
MD5 | 419f5722835401e827200dab164c7716 |
|
BLAKE2b-256 | a9edb31b05f3b75f398081ce52af24ee02713e2efa93b13a5cdbc8619618c798 |
File details
Details for the file csvschemavalidation-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: csvschemavalidation-0.0.8-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab14410b630b90c732cc9ecd6e3fe2cb2ba51c7c1a5cfc029bd01883b375bd7 |
|
MD5 | 0ccbac5c7e289a1a75131b9c70069cee |
|
BLAKE2b-256 | cb6cd5622b8a363a7eaae1f4d06791e1e450cdb3e11e598692835fec696dc479 |