Skip to main content

pyetls

English | 中文

按声明式字段映射投影记录,并做显式类型转换。

安装

pip install pyetls

用法

from pyetls import project

rows = [{"id": "7", "amount": "3.5"}]
mapping = {"code": ("id", int), "total": ("amount", float)}

project(rows, mapping)
# [{'code': 7, 'total': 3.5}]

说明

映射写成 {新字段: 旧字段} 或 {新字段: (旧字段, 类型)},类型只认 str/int/float/bool;源字段缺失或转换失败抛 CoerceError 并带上字段名——不静默补 None,因为那会把脏数据藏到下游。

许可证

MIT


English

Project records through a declared field mapping with explicit type coercion.

Install

pip install pyetls

Usage

from pyetls import project

rows = [{"id": "7", "amount": "3.5"}]
mapping = {"code": ("id", int), "total": ("amount", float)}

project(rows, mapping)
# [{'code': 7, 'total': 3.5}]

Notes

A mapping is {new: old} or {new: (old, type)} with str/int/float/bool. A missing source field or a failed conversion raises CoerceError naming the field — nothing is silently filled with None.

License

MIT

Metadata

Release files for pyetls 0.0.2

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

Source distribution (sdist)

Source distribution for pyetls 0.0.2
File Size Uploaded Provenance Actions
pyetls-0.0.2.tar.gz 3.5 kB Without provenance Details for pyetls-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 7.3 kB

Release files / pyetls-0.0.2.tar.gz

Download URL pyetls-0.0.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c7b4652eb2019ec2cef62a9508c207cc368bf64b32b8ff6744c86d48ecda3fca
BLAKE2b-256 checksum
How to use checksums
25da73dfb8e03111dc96c5f9dc8c49b15512e8c3beddaf4c672f8805e29e0741
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / pyetls-0.0.2-py3-none-any.whl

Download URL pyetls-0.0.2-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7442b46ebed4f3b4cbcd7dd49353bb0fa259bf7b1ff22572f6cd41cc380a6f76
BLAKE2b-256 checksum
How to use checksums
4e5e31543a5fd64e94ab383cdfe2aae1ab0aa5492c63feac086b96897cff674a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for pyetls 0.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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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