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.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c906598746c13ddf986366c4ecd50bdebff6e89bb4017d4c5ceafd10dd30f095 |
|
MD5 | 5879ffaa7b15b90662fc9300026e3113 |
|
BLAKE2b-256 | 1fa77cb991a722505e8e4275a18d40655d591d0a3b78410961fa0cf8c45584b0 |
Hashes for data_snack_dynamic_entity-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571cfacb345f10d7501423b06fbcd587444974d9ebe3994091b0dac72fa18456 |
|
MD5 | 19ed6900fc7148bc6e6f3b81aac5ca25 |
|
BLAKE2b-256 | 1be5d11bd54cbda991b0fbde68805f79e6a78fd24aeab2c59417db668e0df318 |