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()
Metadata
Release files for kraken-class-entity 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kraken-class-entity-0.0.7.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kraken_class_entity-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / kraken-class-entity-0.0.7.tar.gz
| Download URL | kraken-class-entity-0.0.7.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb892198a8d02f3c87c80de7b89dcdf372ece2d9e19f4b4480f87cedc7cd88ac
|
|
BLAKE2b-256 checksum How to use checksums |
89fdf840c1bb1659d293f60fb0576cf4b952d2537e33300de2889a8e1aa30f17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / kraken_class_entity-0.0.7-py3-none-any.whl
| Download URL | kraken_class_entity-0.0.7-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ceeaafe1dfdd6263e9495a4e4fc9e4032df7210fb19cbef4a90d1d4e2c5845f7
|
|
BLAKE2b-256 checksum How to use checksums |
426e80a154599e9b208408772fd81f2f0febdbba416d649122daff8f18a5efce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|