Name | magicmapper JSON |
Version |
0.9.1
JSON |
| download |
home_page | |
Summary | Mapping data structures |
upload_time | 2023-03-12 20:23:30 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7 |
license | MIT |
keywords |
data
mapping
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Magicmapper
Unconventional (?) approach to mapping data from one object to another.
# Usage
Check out test_magic.py for some examples. The fundamental idea is that we
define a target schema which we can populate using the magicmapper.
Consider the following source data
```python
source_data = [
{
"person": {
"name": "foo1"
}
},
{
"person": {
"name": "foo2"
}
},
]
```
Say we'd like to map this to this
```python
destination_data = [
{
"name": "foo1"
},
{
"name": "foo2"
},
]
```
This could be done with the following magicmapping
```python
from magicmapper import magic_map, Schema, Value
magic_map([Schema({"name": Value("person") >> Value("name")})], test_source_data)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "magicmapper",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "data,mapping",
"author": "",
"author_email": "Matti Eiden <snaipperi@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e4/b3/00ab3a535fa308d667507ec617a8ad57715470691edcfd93c5372c135729/magicmapper-0.9.1.tar.gz",
"platform": null,
"description": "# Magicmapper\n\nUnconventional (?) approach to mapping data from one object to another. \n\n\n# Usage\nCheck out test_magic.py for some examples. The fundamental idea is that we \ndefine a target schema which we can populate using the magicmapper. \nConsider the following source data\n\n```python \nsource_data = [\n {\n \"person\": {\n \"name\": \"foo1\"\n }\n },\n {\n \"person\": {\n \"name\": \"foo2\"\n }\n },\n]\n```\n\nSay we'd like to map this to this\n\n\n```python \ndestination_data = [\n {\n \"name\": \"foo1\"\n },\n {\n \"name\": \"foo2\"\n },\n]\n```\n\nThis could be done with the following magicmapping\n\n```python\nfrom magicmapper import magic_map, Schema, Value\n\n\nmagic_map([Schema({\"name\": Value(\"person\") >> Value(\"name\")})], test_source_data)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mapping data structures",
"version": "0.9.1",
"split_keywords": [
"data",
"mapping"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eba6ace9ea47bc61460d381e9bb9c6552bbca865e1b76c7e95b48c6743f23dea",
"md5": "2c47e9dd17c5314b580813f4a6646bfe",
"sha256": "9e9d9d19717a4840cbf024d0846e205746f389cd094f9c9b1fbb295550a88f01"
},
"downloads": -1,
"filename": "magicmapper-0.9.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c47e9dd17c5314b580813f4a6646bfe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4887,
"upload_time": "2023-03-12T20:23:29",
"upload_time_iso_8601": "2023-03-12T20:23:29.193291Z",
"url": "https://files.pythonhosted.org/packages/eb/a6/ace9ea47bc61460d381e9bb9c6552bbca865e1b76c7e95b48c6743f23dea/magicmapper-0.9.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e4b300ab3a535fa308d667507ec617a8ad57715470691edcfd93c5372c135729",
"md5": "933057d76edbb1f87afc6744dde8a175",
"sha256": "45eb9f2649de152979523e074fc76bab19da94d2b484ac8334c74fa77e7141d7"
},
"downloads": -1,
"filename": "magicmapper-0.9.1.tar.gz",
"has_sig": false,
"md5_digest": "933057d76edbb1f87afc6744dde8a175",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5660,
"upload_time": "2023-03-12T20:23:30",
"upload_time_iso_8601": "2023-03-12T20:23:30.755245Z",
"url": "https://files.pythonhosted.org/packages/e4/b3/00ab3a535fa308d667507ec617a8ad57715470691edcfd93c5372c135729/magicmapper-0.9.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-12 20:23:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "magicmapper"
}