Python SDK for PFB format
Project description
:construction: pypfb :construction:
Python SDK to create, explore and modify PFB files.
PFB Schema
Usage
Main
usage: pypfb [-h] {show,dict2pfb,json2pfb,make,rename} ...
PFB tool
positional arguments:
{show,dict2pfb,json2pfb,make,rename}
show Show schema or records of the PFB file
dict2pfb Convert datadictionary into PFB file with schema
json2pfb Convert JSON files correspond to datadictionary into
PFB file
make Make blank record
rename Rename different parts of schema
optional arguments:
-h, --help show this help message and exit
Show different parts of PFB
usage: pypfb show [-h] [-s] [--limit LIMIT] input
positional arguments:
input Path to PFB file
optional arguments:
-h, --help show this help message and exit
-s, --schema Show PFB file schema
--limit LIMIT How many entries to show, -1 for all; ignored for "schema"
Convert datadictionary into PFB schema
usage: pypfb dict2pfb [-h] -d DICTIONARY -o OUTPUT
optional arguments:
-h, --help show this help message and exit
-d DICTIONARY, --dictionary DICTIONARY
Link to dictionary URL
-o OUTPUT, --output OUTPUT
Output PFB file
Convert JSON for corresponding datadictionary to PFB
usage: pypfb json2pfb [-h] -s SCHEMA -o OUTPUT --program PROGRAM
--project PROJECT
dir
positional arguments:
dir Path to directory with input JSON files
optional arguments:
-h, --help show this help message and exit
-s SCHEMA, --schema PFB SCHEMA
Filename for schema PFB file
-o OUTPUT, --output OUTPUT
Filename for resulting PFB file
--program PROGRAM Name of the program
--project PROJECT Name of the project
Make new blank record
usage: pypfb make [-h] [-n NODE] input
positional arguments:
input Path to PFB file
optional arguments:
-h, --help show this help message and exit
-n NODE, --node NODE Node to create
Add new record to PFB
usage: pypfb add [-h] PFB_file JSON_file
Add a record to PFB file from a minified JSON file
positional arguments:
PFB_file pfb file to add record to. Default = test.pfb
JSON_file JSON file to add into the pfb file. Default = test.json
optional arguments:
-h, --help show this help message and exit
Rename different parts of PFB (schema evolution)
usage: pypfb rename [-h] {node,type,enum} ...
positional arguments:
{node,type,enum}
node Rename node
type Rename type (not implemented)
enum Rename enum
optional arguments:
-h, --help show this help message and exit
Rename node
usage: pypfb rename node [-h] -i INPUT -o OUTPUT --name_from NAME_FROM
--name_to NAME_TO
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
-o OUTPUT, --output OUTPUT
--name_from NAME_FROM
--name_to NAME_TO
Rename enum
usage: pypfb rename enum [-h] -i INPUT -o OUTPUT --field_name FILED_NAME --val_from VALUE_FROM
--val_to VALUE_TO
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
-o OUTPUT, --output OUTPUT
--field_name FIELD_NAME
--val_from VALUE_FROM
--val_to VALUE_TO
Examples
pfb dict2pfb -d http://s3.amazonaws.com/dictionary-artifacts/kf-dictionary/1.1.0/schema.json -o ./tests/schema/kf.avro
pfb json2pfb ./tests/data -s ./tests/schema/kf.avro -o tests/pfb-data/test.avro --program DEV --project test
pfb rename node --name_from slide --name_to slide_test -i tests/pfb-data/test.avro -o tests/pfb-data/rename_test.avro
pfb rename enum --field_name state --val_from validated --val_to validated_test -i tests/pfb-data/test.avro -o tests/pfb-data/rename_test.avro
pfb show -s --limit -1 tests/pfb-data/test.avro
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pypfb-0.1.0.tar.gz
(31.9 kB
view hashes)
Built Distributions
pypfb-0.1.0-py2.py3-none-any.whl
(36.8 kB
view hashes)
pypfb-0.1.0-py2-none-any.whl
(36.8 kB
view hashes)
Close
Hashes for pypfb-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f711d69792ca5f8816a3f6b4a944446336b6da586ab958d69b15c37272df8973 |
|
MD5 | 1338f0c68a881dae95e4411df2c0b4cc |
|
BLAKE2b-256 | 8fdef9bab77931a80c627376eb32906c3b897c1af5142cb0e91014ce66f0f31d |