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": "str"
},
"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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cdfc736a5630a819643e1cdf02e70b380163723efbf946ed2220e4505bf7385 |
|
MD5 | 5181ad539317d3642b7e46c9c620903c |
|
BLAKE2b-256 | 75293539c169feb145614baca9b235a95d0486c93c981babfc16a2aa8b5274e9 |
Hashes for data_snack_dynamic_entity-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0baffe4e9e42d52aa21fcaa4735bc1e0e92e06bcb2151ee9383b9a711d4f11f9 |
|
MD5 | 438f4a888acb6ea172c3540519fdeaf0 |
|
BLAKE2b-256 | 83ba8ff7a90c02b0c60ee3a39b5963e9aea6a6f1a91e384aa4a7d05dab1d7d07 |