RelaTable
A relational database -like table of rows.
Supports foreign key -style referencing to an another RelaTable or other containers.
An Example
from relatable import RelaTable
colors = ["red", "blue", "green"]
pet_names = {"dog": "Musti", "cat": "Mirri"}
persons = RelaTable(
primary_key_column="id",
foreign_keys={"color": colors},
rows=[
{"id": 123, "name": "Jaakko", "color": 0},
{"id": 456, "name": "Teppo", "color": 1},
],
)
# Insert new user in the middle of the table
persons.insert(1, {"id": 789, "name": "Seppo", "color": 2})
pets = RelaTable(
# No primary key defined => index is used
foreign_keys={"name": pet_names, "owner": persons},
rows=[
{"name": "cat", "owner": 123}, # index 0
{"name": "dog", "owner": 456}, # index 1
],
)
print(persons)
# Prints out:
# [{'id': 123, 'name': 'Jaakko', 'color': 'red'},
# {'id': 789, 'name': 'Seppo', 'color': 'green'},
# {'id': 456, 'name': 'Teppo', 'color': 'blue'}]
print(pets)
# Prints out:
# [{'name': 'Mirri', 'owner': {'id': 123, 'name': 'Jaakko', 'color': 'red'}},
# {'name': 'Musti', 'owner': {'id': 456, 'name': 'Teppo', 'color': 'blue'}}]
print(persons[789].name)
# Prints out:
# Seppo
print(pets[0].owner.color)
# Prints out:
# red
print(pets[0].data())
# Prints out the non-expanded row data:
# {'name': 'cat', 'owner': 123}
Metadata
Release files for talamus-relatable 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| talamus_relatable-1.0.2.tar.gz | 5.7 kB | Without provenance | Details for talamus_relatable-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| talamus_relatable-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for talamus_relatable-1.0.2-py3-none-any.whl |
Total release size: 12.3 kB
Release files / talamus_relatable-1.0.2.tar.gz
| Download URL | talamus_relatable-1.0.2.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c7e16fd9beb684f7612a5679a2a2445152e0b55287542c3d12ff0f2e7a71674
|
|
BLAKE2b-256 checksum How to use checksums |
5ebdacf3803aaa4f6aae690ea65ee09d49d1a9bd1023efd04f479807d2de8636
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.11.0 Linux/5.15.0-1022-azure
|
Release files / talamus_relatable-1.0.2-py3-none-any.whl
| Download URL | talamus_relatable-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f0c1d8ffb50ae1933d33574ae48edf22b8ecf9dac4c88723895e2f151cf8b32
|
|
BLAKE2b-256 checksum How to use checksums |
ace1fe34d933bcf1a4e8100351502c0533171fca92658e626f366514a17aefb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.11.0 Linux/5.15.0-1022-azure
|
Security for talamus-relatable 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.