Name | armored JSON |
Version |
0.0.3
JSON |
| download |
home_page | |
Summary | Armored that implements Model objects for Data Pipeline |
upload_time | 2024-02-12 07:14:01 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.9.0 |
license | |
keywords |
models
armored
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Utility Package: *Armored*
[![test](https://github.com/korawica/armored/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/korawica/armored/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/korawica/armored/graph/badge.svg?token=OOUHC5SW4A)](https://codecov.io/gh/korawica/armored)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/armored?logo=pypi)](https://pypi.org/project/armored/)
[![size](https://img.shields.io/github/languages/code-size/korawica/armored)](https://github.com/korawica/armored)
**Table of Contents**:
- [Installation](#installation)
- [Models](#models)
- [Data Types](#data-types)
- [Constraints](#constraints)
- [Datasets](#datasets)
- [Lineages](#lineages)
- [Enums](#enums)
- [Usecase](#usecase)
This models package, **Armored**, implements any model objects for **Data Pipeline**
or **Data Platform**. The Model objects was implemented from the [Pydantic V2](https://docs.pydantic.dev/latest/).
The model able to handle common logic validations and able to adjust by custom code
for your specific requirements (Yeah, it just inherits Sub-Class from `BaseModel`).
## Installation
```shell
pip install -U armored
```
## Models
### Data Types
```python
from armored.dtype import StringType
dtype = StringType()
assert dtype.type == "string"
assert dtype.max_length == -1
```
### Constraints
```python
from armored.const import Pk
const = Pk(of="foo", cols=["bar", "baz"])
assert const.name == "foo_bar_baz_pk"
assert const.cols == ["bar", "baz"]
```
### Datasets
```python
from armored.datasets import Col, Tbl
col = Col(name="foo", dtype="varchar( 100 )")
assert "foo" == col.name
assert "varchar" == col.dtype.type
assert 100 == col.dtype.max_length
tbl = Tbl(
name="foo",
feature=[
Col(name="id", dtype="integer primary key"),
Col(name="foo", dtype="varchar( 10 )"),
],
)
assert "foo" == tbl.name
assert "id" == tbl.feature[0].name
```
### Lineages
## Enums
## Usecase
If I have some catalog config, it easy to pass this config to model object.
```python
import yaml
from pydantic import BaseModel
from armored.datasets import Tbl
class Schema(BaseModel):
name: str
objects: list[Tbl]
config = yaml.safe_load("""
name: "warehouse"
objects:
- name: "customer_master"
feature:
- name: "id"
dtype: "integer"
pk: true
- name: "name"
dtype: "varchar( 256 )"
nullable: false
""")
feature = Schema.model_validate(config)
assert 1 == len(feature.objects)
```
## License
This project was licensed under the terms of the [MIT license](LICENSE).
Raw data
{
"_id": null,
"home_page": "",
"name": "armored",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9.0",
"maintainer_email": "korawica <korawich.anu@gmail.com>",
"keywords": "models,armored",
"author": "",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/59/bb/51e4e52449d65e9f5fc9b7876f1398f457321e55a0af6d6d9836853c55ad/armored-0.0.3.tar.gz",
"platform": null,
"description": "# Utility Package: *Armored*\n\n[![test](https://github.com/korawica/armored/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/korawica/armored/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/korawica/armored/graph/badge.svg?token=OOUHC5SW4A)](https://codecov.io/gh/korawica/armored)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/armored?logo=pypi)](https://pypi.org/project/armored/)\n[![size](https://img.shields.io/github/languages/code-size/korawica/armored)](https://github.com/korawica/armored)\n\n**Table of Contents**:\n\n- [Installation](#installation)\n- [Models](#models)\n - [Data Types](#data-types)\n - [Constraints](#constraints)\n - [Datasets](#datasets)\n - [Lineages](#lineages)\n- [Enums](#enums)\n- [Usecase](#usecase)\n\nThis models package, **Armored**, implements any model objects for **Data Pipeline**\nor **Data Platform**. The Model objects was implemented from the [Pydantic V2](https://docs.pydantic.dev/latest/).\n\nThe model able to handle common logic validations and able to adjust by custom code\nfor your specific requirements (Yeah, it just inherits Sub-Class from `BaseModel`).\n\n## Installation\n\n```shell\npip install -U armored\n```\n\n## Models\n\n### Data Types\n\n```python\nfrom armored.dtype import StringType\n\ndtype = StringType()\nassert dtype.type == \"string\"\nassert dtype.max_length == -1\n```\n\n### Constraints\n\n```python\nfrom armored.const import Pk\n\nconst = Pk(of=\"foo\", cols=[\"bar\", \"baz\"])\nassert const.name == \"foo_bar_baz_pk\"\nassert const.cols == [\"bar\", \"baz\"]\n```\n\n### Datasets\n\n```python\nfrom armored.datasets import Col, Tbl\n\ncol = Col(name=\"foo\", dtype=\"varchar( 100 )\")\nassert \"foo\" == col.name\nassert \"varchar\" == col.dtype.type\nassert 100 == col.dtype.max_length\n\ntbl = Tbl(\n name=\"foo\",\n feature=[\n Col(name=\"id\", dtype=\"integer primary key\"),\n Col(name=\"foo\", dtype=\"varchar( 10 )\"),\n ],\n)\nassert \"foo\" == tbl.name\nassert \"id\" == tbl.feature[0].name\n```\n\n### Lineages\n\n## Enums\n\n## Usecase\n\nIf I have some catalog config, it easy to pass this config to model object.\n\n```python\nimport yaml\nfrom pydantic import BaseModel\nfrom armored.datasets import Tbl\n\n\nclass Schema(BaseModel):\n name: str\n objects: list[Tbl]\n\n\nconfig = yaml.safe_load(\"\"\"\nname: \"warehouse\"\nobjects:\n - name: \"customer_master\"\n feature:\n - name: \"id\"\n dtype: \"integer\"\n pk: true\n - name: \"name\"\n dtype: \"varchar( 256 )\"\n nullable: false\n\"\"\")\nfeature = Schema.model_validate(config)\nassert 1 == len(feature.objects)\n```\n\n## License\n\nThis project was licensed under the terms of the [MIT license](LICENSE).\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Armored that implements Model objects for Data Pipeline",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/korawica/armored/",
"Source Code": "https://github.com/korawica/armored/"
},
"split_keywords": [
"models",
"armored"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9ffe182a486bf465c913329be1ca08db7d17759831d485c901e8729e90bdab16",
"md5": "0b6819fb43ad5e579d1cbb22d8f39ed8",
"sha256": "be06ea075680a754d0484d22f9d992389edfd460d31c17ad879c648cbe54467d"
},
"downloads": -1,
"filename": "armored-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b6819fb43ad5e579d1cbb22d8f39ed8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9.0",
"size": 16130,
"upload_time": "2024-02-12T07:13:59",
"upload_time_iso_8601": "2024-02-12T07:13:59.933812Z",
"url": "https://files.pythonhosted.org/packages/9f/fe/182a486bf465c913329be1ca08db7d17759831d485c901e8729e90bdab16/armored-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59bb51e4e52449d65e9f5fc9b7876f1398f457321e55a0af6d6d9836853c55ad",
"md5": "7b2a5521c885bd1098b4a8c6775735f7",
"sha256": "48da0b3edd06399781435caff5308da7d453313e46530b9a86b758bb3e0daacd"
},
"downloads": -1,
"filename": "armored-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "7b2a5521c885bd1098b4a8c6775735f7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9.0",
"size": 16418,
"upload_time": "2024-02-12T07:14:01",
"upload_time_iso_8601": "2024-02-12T07:14:01.311536Z",
"url": "https://files.pythonhosted.org/packages/59/bb/51e4e52449d65e9f5fc9b7876f1398f457321e55a0af6d6d9836853c55ad/armored-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-12 07:14:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "korawica",
"github_project": "armored",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "armored"
}