Skip to main content

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

source_data = [
    {
        "person": {
            "name": "foo1"
        }
    },
    {
        "person": {
            "name": "foo2"
        }
    },
]

Say we'd like to map this to this

destination_data = [
    {
        "name": "foo1"
    },
    {
        "name": "foo2"
    },
]

This could be done with the following magicmapping

from magicmapper import magic_map, Schema, Value


magic_map([Schema({"name": Value("person") >> Value("name")})], test_source_data)

Release files for magicmapper 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magicmapper 0.9.1
File Size Uploaded
magicmapper-0.9.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for magicmapper 0.9.1
File Interpreter ABI Platform
magicmapper-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / magicmapper-0.9.1.tar.gz

Download URL magicmapper-0.9.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
45eb9f2649de152979523e074fc76bab19da94d2b484ac8334c74fa77e7141d7
BLAKE2b-256 checksum
How to use checksums
e4b300ab3a535fa308d667507ec617a8ad57715470691edcfd93c5372c135729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release files / magicmapper-0.9.1-py3-none-any.whl

Download URL magicmapper-0.9.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e9d9d19717a4840cbf024d0846e205746f389cd094f9c9b1fbb295550a88f01
BLAKE2b-256 checksum
How to use checksums
eba6ace9ea47bc61460d381e9bb9c6552bbca865e1b76c7e95b48c6743f23dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page