Metadata-Version: 2.4
Name: iparq
Version: 0.6.0
Summary: Inspect Parquet metadata, encodings, compression, indexes, and Bloom filters
Project-URL: Homepage, https://github.com/MiguelElGallo/iparq
Project-URL: Repository, https://github.com/MiguelElGallo/iparq
Project-URL: Issues, https://github.com/MiguelElGallo/iparq/issues
Author-email: MiguelElGallo <miguel.zurcher@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: pyarrow>=25.0.0
Requires-Dist: pydantic>=2.13.4
Requires-Dist: rich>=15.0.0
Requires-Dist: typer>=0.27.0
Provides-Extra: checks
Requires-Dist: mypy>=2.3.0; extra == 'checks'
Requires-Dist: ruff>=0.15.22; extra == 'checks'
Requires-Dist: ty>=0.0.61; extra == 'checks'
Provides-Extra: test
Requires-Dist: pytest-cov>=7.1.0; extra == 'test'
Requires-Dist: pytest>=9.1.1; extra == 'test'
Description-Content-Type: text/markdown

# iparq

[![Python package](https://github.com/MiguelElGallo/iparq/actions/workflows/python-package.yml/badge.svg)](https://github.com/MiguelElGallo/iparq/actions/workflows/python-package.yml)

[![Dependabot Updates](https://github.com/MiguelElGallo/iparq/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/MiguelElGallo/iparq/actions/workflows/dependabot/dependabot-updates)

[![Upload Python Package](https://github.com/MiguelElGallo/iparq/actions/workflows/python-publish.yml/badge.svg)](https://github.com/MiguelElGallo/iparq/actions/workflows/python-publish.yml)

[![codecov](https://codecov.io/gh/MiguelElGallo/iparq/branch/main/graph/badge.svg)](https://codecov.io/gh/MiguelElGallo/iparq)

![alt text](media/iparq.png)
After reading [this blog](https://duckdb.org/2025/01/22/parquet-encodings.html), I began to wonder which Parquet version and compression methods the everyday tools we rely on actually use, only to find that there's no straightforward way to determine this. That curiosity and the difficulty of quickly discovering such details motivated me to create iparq (Information Parquet). My goal with iparq is to help users easily identify the specifics of the Parquet files generated by different engines, making it clear which features—like newer encodings or certain compression algorithms—the creator of the parquet is using.

## Features

- **Bloom filters**: Detects real Bloom-filter metadata and reports its size. Read more in this [great article](https://duckdb.org/2025/03/07/parquet-bloom-filters-in-duckdb.html).
- **Encodings and types**: Shows physical and logical types plus encodings such as `RLE_DICTIONARY`, `DELTA_BINARY_PACKED`, and `BYTE_STREAM_SPLIT`.
- **Indexes and dictionary pages**: Reports dictionary pages, column indexes, and offset indexes.
- **Statistics**: Displays min/max values and available null and distinct counts.
- **Compression**: Shows codecs with optional column sizes and compression ratios.
- **Machine-readable output**: Emits JSON for scripts and agent workflows.

iParq requires Python 3.10 or later.

## Installation

### Zero installation - Recommended

1) Make sure to have Astral's UV installed by following the steps here:  

    <https://docs.astral.sh/uv/getting-started/installation/>

2) Execute the following command:

    ```sh
    uvx --refresh iparq inspect yourparquet.parquet
    ```

### Using pip

1) Install the package using pip:

    ```sh
    pip install iparq
    ```

2) Verify the installation by running:

    ```sh
    iparq --help
    ```

### Using uv

1) Make sure to have Astral's UV installed by following the steps here:  

    <https://docs.astral.sh/uv/getting-started/installation/>

2) Execute the following command:

    ```sh
    uv pip install iparq
    ```

3) Verify the installation by running:

    ```sh
    iparq --help
    ```

### Using Homebrew in a MAC

1) Run the following:

    ```sh
    brew tap MiguelElGallo/tap https://github.com/MiguelElGallo//homebrew-iparq.git
    brew install MiguelElGallo/tap/iparq
    iparq --help
    ```

## Usage

iparq supports inspecting single files, multiple files, and glob patterns:

```sh
iparq inspect <filename(s)> [OPTIONS]
```

Options include:

- `--format`, `-f`: Output format, either `rich` (default) or `json`
- `--metadata-only`, `-m`: Show only file metadata without column details
- `--column`, `-c`: Filter results to show only a specific column
- `--sizes`, `-s`: Show column sizes and compression ratios
- `--details`, `-d`: Show encodings, types, indexes, Bloom-filter size, and detailed statistics

### Single File Examples:

```sh
# Basic inspection .
iparq inspect yourfile.parquet

# Output in JSON format
iparq inspect yourfile.parquet --format json

# Show only metadata
iparq inspect yourfile.parquet --metadata-only

# Filter to show only a specific column
iparq inspect yourfile.parquet --column column_name

# Show column sizes and compression ratios
iparq inspect yourfile.parquet --sizes

# Show storage-level details
iparq inspect yourfile.parquet --details
```

### Multiple Files and Glob Patterns:

```sh
# Inspect multiple specific files
iparq inspect file1.parquet file2.parquet file3.parquet

# Use glob patterns to inspect all parquet files
iparq inspect *.parquet

# Use specific patterns
iparq inspect yellow*.parquet data_*.parquet

# Combine patterns and specific files
iparq inspect important.parquet temp_*.parquet
```

When inspecting multiple files, each file's results are displayed with a header showing the filename. The utility will read the metadata of each file and print the compression codecs used in the parquet files.

For scripts and agents, add `--format json`. A single file produces one JSON
object; multiple files produce one JSON array whose entries include `file`.
Diagnostics are written to stderr, and any unreadable input makes the command
exit non-zero without corrupting successful JSON output.

## Example output

```log
ParquetMetaModel(
    created_by='parquet-cpp-arrow version 14.0.2',
    num_columns=3,
    num_rows=3,
    num_row_groups=1,
    format_version='2.6',
    serialized_size=2223
)
                                     Parquet Column Information                                      
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Row Group ┃ Column Name ┃ Index ┃ Compression ┃ Bloom ┃ Min Value ┃ Max Value ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━┩
│     0     │ one         │   0   │ SNAPPY      │  ❌   │ -1.0      │ 2.5       │
│     0     │ two         │   1   │ SNAPPY      │  ❌   │ bar       │ foo       │
│     0     │ three       │   2   │ SNAPPY      │  ❌   │ False     │ True      │
└───────────┴─────────────┴───────┴─────────────┴───────┴───────────┴───────────┘
Compression codecs: {'SNAPPY'}
```

### With `--sizes` flag

```log
iparq inspect yourfile.parquet --sizes

                                         Parquet Column Information                                         
┏━━━━━━━━┳━━━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃  Row   ┃ Column  ┃       ┃        ┃       ┃           ┃           ┃        ┃        ┃       ┃
┃ Group  ┃ Name    ┃ Index ┃ Compr… ┃ Bloom ┃ Min Value ┃ Max Value ┃ Values ┃ Compr… ┃ Ratio ┃
┡━━━━━━━━╇━━━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│   0    │ one     │   0   │ SNAPPY │  ❌   │ -1.0      │ 2.5       │      3 │ 104.0B │  1.0x │
│   0    │ two     │   1   │ SNAPPY │  ❌   │ bar       │ foo       │      3 │  80.0B │  0.9x │
│   0    │ three   │   2   │ SNAPPY │  ❌   │ False     │ True      │      3 │  42.0B │  1.0x │
└────────┴─────────┴───────┴────────┴───────┴───────────┴───────────┴────────┴────────┴───────┘
```
