No project description provided
Project description
Data Snack - Dynamic entity
About
Used to dynamically load data-snack
Entity
objects from json schema.
Especially useful for complex dataset with many fields.
Install
Data Snack can be easily installed using pypi repository.
pip install data_snack_dynamic_entity
Usage
1. Define Entity template
First you need to define a dictionary containing the template - a configuration for your Entity type. Template should contain:
- the name of the new Entity type and its properties
- each property should have:
type
- type of the fielddefault
- default value (optional property)optional
- true if the field is optional (optional property)
Notice that your template can be saved in any file of your choosing. Just make sure it's later parsed to a dictionary in the right format.
The template is defined using following schema: src/data_snack_dynamic_entity/entityTemplates.schema.json
.
Example
{
"Car": {
"properties": {
"name": {
"type": "string"
},
"cost": {
"type": "float",
"default": 10.0,
"optional": True
}
}
}
}
2. Load the template and create new types
Now you are ready to create entities based on your template:
from data_snack_dynamic_entity.factory import load_entities
entities = load_entities(templates=your_config)
After that entities
will contain a dictionary in the following format:
{
"entity_name": EntityType
}
Contact
Plugin was created by the Data Science team from Webinterpret.
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
Hashes for data_snack_dynamic_entity-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc13135817790c1df2cc03c074beba331ceb13d37f38cf85d6060452da6b06a |
|
MD5 | 35f625ab265922f96a0ef2cdb9527a48 |
|
BLAKE2b-256 | b0e1efc23760e06ca89010927177f493e1febd3ebf86119cc07d16f3da64af40 |
Hashes for data_snack_dynamic_entity-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c0f6c6069d5119e0bb97da3110f5181594343cab37c900dec74f3e53de1fa22 |
|
MD5 | cc59bacf67efd5608292b10ad1026ca4 |
|
BLAKE2b-256 | 4476fcba8d7ee43b516c125109fee885856102742dc272a33a8c55ece1a5b366 |