Skip to main content

parquet-python

https://travis-ci.org/jcrobak/parquet-python.svg?branch=master

parquet-python is a pure-python implementation (currently with only read-support) of the parquet format. It comes with a script for reading parquet files and outputting the data to stdout as JSON or TSV (without the overhead of JVM startup). Performance has not yet been optimized, but it’s useful for debugging and quick viewing of data in files.

Not all parts of the parquet-format have been implemented yet or tested e.g. nested data—see Todos below for a full list. With that said, parquet-python is capable of reading all the data files from the parquet-compatability project.

requirements

parquet-python has been tested on python 2.7, 3.6, and 3.7. It depends on pythrift2 and optionally on python-snappy (for snappy compressed files, please also install parquet-python[snappy]).

getting started

parquet-python is available via PyPi and can be installed using pip install parquet. The package includes the parquet command for reading python files, e.g. parquet test.parquet. See parquet –help for full usage.

Example

parquet-python currently has two programatic interfaces with similar functionality to Python’s csv reader. First, it supports a DictReader which returns a dictionary per row. Second, it has a reader which returns a list of values for each row. Both function require a file-like object and support an optional columns field to only read the specified columns.

import parquet
import json

## assuming parquet file with two rows and three columns:
## foo bar baz
## 1   2   3
## 4   5   6

with open("test.parquet") as fo:
   # prints:
   # {"foo": 1, "bar": 2}
   # {"foo": 4, "bar": 5}
   for row in parquet.DictReader(fo, columns=['foo', 'bar']):
       print(json.dumps(row))


with open("test.parquet") as fo:
   # prints:
   # 1,2
   # 4,5
   for row in parquet.reader(fo, columns=['foo', 'bar]):
       print(",".join([str(r) for r in row]))

Todos

  • Support the deprecated bitpacking

  • Fix handling of repetition-levels and definition-levels

  • Tests for nested schemas, null data

  • Support reading of data from HDFS via snakebite and/or webhdfs.

  • Implement writing

  • performance evaluation and optimization (i.e. how does it compare to the c++, java implementations)

Contributing

Is done via Pull Requests. Please include tests with your changes and follow pep8.

To run the tests you must install and execute tox (pip install tox) to run for all supported versions. If you want to run just for your current version, execute: pip install -r requirements-development.txt and then nosetests.

Release files for parquet 1.3.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 parquet 1.3.1
File Size Uploaded
parquet-1.3.1.tar.gz 23.1 kB Details

Built distribution (wheel)

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

Total release size:47.7 kB

Release files / parquet-1.3.1.tar.gz

Download URL parquet-1.3.1.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fb1c90768c1b9159d4d6a9b3112ea8107b0b46d7491c5ac452ba7350f333bf0a
BLAKE2b-256 checksum
How to use checksums
390656482f6834135a67dfc5a2bfce071a75be5c8c91edd8e319d69eb56b4644
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

Release files / parquet-1.3.1-py3-none-any.whl

Download URL parquet-1.3.1-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a492a08643b51af8b4c2a25d97e1667170a483fc68ca408979b080ae9d771f51
BLAKE2b-256 checksum
How to use checksums
14a6d57a2fe5caac3e0e0cdb78c0e450f30f953a590ecf94478065f33feb3d8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3

2 release files

1.2

3 release files

1.1

3 release files

1.0

1 release file

0.0.0

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