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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c937919972d55eff05cc12826fad419b9adbcbdfb82f2f1c7c16b65d7e0c2e6 |
|
MD5 | 9c715f98bfd49e9e468b110ed54fae66 |
|
BLAKE2b-256 | 43b2d55b843c1b86a96b16ea63ca3e69ea06a9dd3c4b1d4261ff957e5e56b282 |
Hashes for data_snack_dynamic_entity-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df7d3b3b222fc4cf74e2ada44d9114ef4f254b58e57e394b29be63c1572413a4 |
|
MD5 | b7129458d17ac8c1894c91291764dfa8 |
|
BLAKE2b-256 | b24d313ebdd85d25e2e43cf30c81e2e3e0e0d939f81e8822b02399ff707e8dd1 |