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.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 535f3926e32a6ba09ef6c6e0dee03a04511e691f9393cef8e711a4ccf67c0250 |
|
MD5 | 0ca4bc94c831fda65493973f224405f6 |
|
BLAKE2b-256 | 312b2aa31345ee77b18ee604b5a7d3bada2f8f3dd48fe8e00f6f6b4e3988d2d7 |
Hashes for data_snack_dynamic_entity-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bf0eb7f8a56445c69b0ba8cbbb5f6565f1be922919f4ad549adab70a24b6601 |
|
MD5 | 08da44f5a09dc226aecc4bf3fce83f22 |
|
BLAKE2b-256 | 91bcaeb2c0bc626593149b465b1d67b58e7fcf9229c01c60a6803b42dad06fe5 |