Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
/ data-transformers Public archive

A library to transforming JSON with parsers.

Notifications You must be signed in to change notification settings

invana/data-transformers

Repository files navigation

Data Transformers

A library to transforming JSON with parsers.

Build Status codecov

install

pip install git+https://github.com/invanalabs/data-transformers#egg=transformers

Usage

from transformers.executors import ReadFromFile
from transformers.transforms import UrlDomainTransformer, OTConf, FloatTransform, RegexTransform, OTManager
import json

file_executor = ReadFromFile('samples/crawler_data.json')
ops = [OTConf('items.url', UrlDomainTransformer, update_element=True, update_key="domain"),
       OTConf('items.item_no', FloatTransform, update_element=True, update_key='item_no_float'),
       OTConf('items.description', RegexTransform, regex='(\w{5,100})', update_element=True,
              update_key='keywords')]
result = OTManager(ops).process(file_executor).results
with open('samples/tests_results_expected/sample1.json') as fp:
    expected = json.load(fp)
    fp.close()

About

A library to transforming JSON with parsers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages