Kraken Class entity
Project description
Entity class api
Generic class library to interact with kraken db through api.
The library handles type and key conversion to ensure compliance.
Features
- Automatic schema type correction (imageobject --> schema:ImageObject)
- Automatic record_id assignation if missing
- Automatic variable name (key) correction (familyname --> schema:familyName)
- Automatic value type correction (www.test.com --> https://www.test.com/)
How to use:
- entity: single entity record
- entities: collection of entity records
Entity
Initialize
entity = Entity()
entity.record_type = 'schema:Person'
entity.record_id = 'abc'
Get/store data
name = entity.get('givenName')
entity.set('givenName', name)
Get/store record / json
entity.record = record
record = entity.record
entity.json = json_string
json_string = entity.json
Get and store data to database
Set once for all subsequent entities
entity.api_url = 'url_to_use'
Get from db
entity.get_api()
entity.get_api_async()
Post to db
entity.post_api()
entity.post_api_async()
Entities
Initialize
entities = Entities()
entities.record_type = 'schema:Person'
entities.record_id = 'abc'
Load / dump data
Will convert records to entity
records = entity.dump()
entity.load(records)
Attributes
- entity.ref_id: dict reference to record ({'@type': 'record_type', '@id': 'record_id'})
Get/store record / json
entities.record = record
record = entities.record
entities.json = json_string
json_string = entities.json
Get and store data to database
Set once for all subsequent entities
entities.api_url = 'url_to_use'
Get from db
entities.get_api()
entities.get_api_async()
Post to db
entities.post_api()
entities.post_api_async()
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
File details
Details for the file kraken-class-entity-0.0.6.tar.gz
.
File metadata
- Download URL: kraken-class-entity-0.0.6.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39b5eaf24db51f587c2e93c3b8b98bddcc1c93f9cb019621d018cce574927704 |
|
MD5 | 30b1d7f61f312ab2595ddcc2ea29c6b0 |
|
BLAKE2b-256 | d9d1e0b48c9fb1b539c3c4668df745f57b23e5079a6b7bfd00fc8eb0283471f6 |
File details
Details for the file kraken_class_entity-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: kraken_class_entity-0.0.6-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ada7087d5a4990958d5a501bfc80dcf37e606f7f65151a3735b8c078f229c36 |
|
MD5 | fa6e3d3aabc27c9bb0cf62463dcc8cc5 |
|
BLAKE2b-256 | 981b53c4c93f4f6594eab308ae5c2ee35772d3f98f311efd987d14cb53070c98 |