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.0.5.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for data_snack_dynamic_entity-0.0.5.tar.gz
Algorithm Hash digest
SHA256 614f384d1393422bd0001b0feff0928f70e41dff4683484797cbcd2898a0e03d
MD5 5438ee5cb7aee1fb157ac2251a6d8faf
BLAKE2b-256 4d0b503221f4e3e9ce736124383295ed2a6e7d645c8be55909fca4a4485e92e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for data_snack_dynamic_entity-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e439989dcd066ff355eeb6aa2de072d3bf3def318d84d43be0943fd94d5d5e1b
MD5 e354f2e15d6156247b567550ee1c391a
BLAKE2b-256 de59e152cc59406e1299f291f59176b43ba66b66fc55d30e72dd672a9c30faff

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