Skip to main content

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 field
    • default - 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_snack_dynamic_entity-0.3.3.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file data_snack_dynamic_entity-0.3.3.tar.gz.

File metadata

File hashes

Hashes for data_snack_dynamic_entity-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e27e0163bf10a98a81a668c6960fce4c1d7141868a8b5592fbd8705f0c7b6dee
MD5 52a013d953305dd29c01370e949108d2
BLAKE2b-256 d5bb2e1e31d4eec2f9dc6d4e9ed230f4b58f48fd2a6943dfb97adf4a62c8cba2

See more details on using hashes here.

File details

Details for the file data_snack_dynamic_entity-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for data_snack_dynamic_entity-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f14837fc2ef331a67e77770fdd85db51db787c20431ec6fe9e7ab6ffea2a6c67
MD5 57c48777a8b7b86c25ac362a19339aae
BLAKE2b-256 4530f083de246a5df926b844192c93390bebfa7ba8a803200f5356257b926d09

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page