# 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)

![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.

***New*** Bloom filters information: Displays if there are bloom filters.
Read more about bloom filters in this [great article](https://duckdb.org/2025/03/07/parquet-bloom-filters-in-duckdb.html).

## 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

### 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
```

### 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.

## Example ouput - Bloom Filters

```log
ParquetMetaModel(
    created_by='DuckDB version v1.2.1 (build 8e52ec4395)',
    num_columns=1,
    num_rows=100000000,
    num_row_groups=10,
    format_version='1.0',
    serialized_size=1196
)
                   Parquet Column Information                   
┏━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Row Group ┃ Column Name ┃ Index ┃ Compression ┃ Bloom Filter ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│     0     │ r           │   0   │ SNAPPY      │      ✅      │
│     1     │ r           │   0   │ SNAPPY      │      ✅      │
│     2     │ r           │   0   │ SNAPPY      │      ✅      │
│     3     │ r           │   0   │ SNAPPY      │      ✅      │
│     4     │ r           │   0   │ SNAPPY      │      ✅      │
│     5     │ r           │   0   │ SNAPPY      │      ✅      │
│     6     │ r           │   0   │ SNAPPY      │      ✅      │
│     7     │ r           │   0   │ SNAPPY      │      ✅      │
│     8     │ r           │   0   │ SNAPPY      │      ✅      │
│     9     │ r           │   0   │ SNAPPY      │      ✅      │
└───────────┴─────────────┴───────┴─────────────┴──────────────┘
Compression codecs: {'SNAPPY'}
```
