Skip to main content

Parquet tools for CJWorkbench.

Workbench modules may optionally depend on the latest version of this Python package for its cjwparquet.api.* functions.

Installation

This is meant to be used within a Docker container. It depends on executables /usr/bin/parquet-to-arrow and /usr/bin/parquet-to-text-stream.

Your Dockerfile might look something like this:

FROM workbenchdata/parquet-tools:v2.1.0 AS parquet-tools
FROM python:3.8.5-buster AS main

COPY --from=parquet-tools /usr/bin/parquet-to-arrow /usr/bin/parquet-to-arrow
COPY --from=parquet-tools /usr/bin/parquet-to-text-stream /usr/bin/parquet-to-text-stream

# And now that these binaries are accessible, you can install cjwparquet...

Usage

from pathlib import Path
import cjwparquet
import pyarrow

# Write a Parquet file
cjwparquet.write(Path("test.parquet"), pyarrow.table({"A": ["foo", "bar"]}))

# Test whether a file looks like a Parquet file
if cjwparquet.file_has_parquet_magic_number(Path("test.parquet")):
    # Read a Parquet file
    with cjwparquet.open_as_mmapped_arrow(Path("test.parquet")) as table:
        assert table.to_pydict() == {"A": ["foo", "bar"]}

    # Convert to text
    text = cjwparquet.read_slice_as_text(
        Path("test.parquet"),
        format="csv",
        only_columns=range(0, 20),
        only_rows=range(0, 200),
    )
    assert text == "A\nfoo\nbar"

Developing

  1. Run tests: docker build .
  2. Write a failing unit test in tests/
  3. Make it pass by editing code in cjwparquet/
  4. black cjwparquet tests && isort cjwparquet tests
  5. Submit a pull request

Be very, very, very careful to preserve a consistent API. Workbench will upgrade this dependency without module authors' explicit consent. Add new features; fix bugs. Never change functionality.

Publishing

  1. Write a new version= to setup.py. Adhere to semver. (As changes must be backwards-compatible, the version will always start with 1 and look like 1.x.y.)
  2. Prepend notes to CHANGELOG.md about the new version
  3. git commit
  4. git tag v1.x.y
  5. git push --tags && git push
  6. Wait for Travis to push our changes to PyPI

Metadata

Release files for cjwparquet 2.2.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 cjwparquet 2.2.1
File Size Uploaded Provenance Actions
cjwparquet-2.2.1.tar.gz 5.6 kB Without provenance Details for cjwparquet-2.2.1.tar.gz

Release files / cjwparquet-2.2.1.tar.gz

Download URL cjwparquet-2.2.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f1d21c183d967282ef6644c26120902d2faa84c79273e138f69154f563465289
BLAKE2b-256 checksum
How to use checksums
25e5a6dba269eec253d64fcfefeb5d3638125b0db09167dc05b723cdc07330c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.4

Security for cjwparquet 2.2.1

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.

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