A Data Validation Framework
Project description
Kye Validation Tool
Kye is a validation tool in progress that allows you to define models to validate your data against.
Getting Started
Install
pip install kye
Run
Pass the location of the kye file, the data (.csv
, .json
or .jsonl
) file, and the name of the Model to evaluate the data against. If the data does not pass the model's assertions then the errors and errant data will be displayed.
kye user.kye --data users.csv --model User
Models are defined in a .kye
file using the Kye language.
The Kye language can optionally be compiled into a json or yaml file. Using the -c
flag followed by a path to a .json
or .yaml
file. Run the compiled file like you would a normal .kye
file
kye user.kye -c user.kye.yaml
kye user.kye.yaml --data users.csv --model User
Kye Models
User(id)(username) {
id: Number
username: String
name: String
age?: Number
assert age > 0 & age <= 120
}
Models
The above Kye script defines a User
table.
Table names must be upper-cased.
Indexes
The name of the table is followed by its index definition.
The (id)(username)
means that we expect
both the id
or username
columns to be able
to uniquely identify a record.
Composite indexes are defined by listing multiple
column names within a single set of parenthesis ex. (id, username)
Columns
Column names must start with a lowercase and not contain spaces or other special characters. If the source data has column names that don't follow these rules, then you can specify the full column name in quotes after the column name.
id "User Id": Number
The column definitions specify the value type as Number
, String
or Boolean
. More data types like date/time and user defined types are coming soon.
You can specify whether the column allows null values by prefixing the colon with a ?
age?: Number
You can also specify if the column allows multiple values (like an array of values) by using +
if you expect at least one value, or *
if it is okay to have no values.
# Expect at least one version
versions+: String
# It's okay for a post to have no tags
tags*: String
Assertions
You can specify extra assertions through the assert
keyword. Just write an expression that evaluates to true or false, and the rows that evaluate to false will be flagged. You can reference columns by their names.
Expressions support the basic operations:
+ - * / %
math== != >= > < <=
comparison! & | ^
logical (not, and, or, xor)()
parenthesis
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
Built Distribution
File details
Details for the file kye-0.1.2.tar.gz
.
File metadata
- Download URL: kye-0.1.2.tar.gz
- Upload date:
- Size: 65.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ea7ec7ae72675b633f56c990a0502711e23440fc213f41c8ff4bcf1d3d5a7cc |
|
MD5 | c1c97a5e0abf832e08ddee04783db8db |
|
BLAKE2b-256 | 932f74f6ab2a208596ab767bece6954a46746095d3d4df41ec361c4fda0dd313 |
File details
Details for the file kye-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: kye-0.1.2-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5c66b773c66242b337c18488e553d121929b3e574bf313934a77c678a82c502 |
|
MD5 | 16ffe187252002a06d14b2c9ad627860 |
|
BLAKE2b-256 | c2cf09d6b2691c08e0a046d3b95bf4a593a2e3bfe6d4514349726d9cd8447383 |