maxcountryman/warc-parquet
๐๏ธ A simple CLI for converting WARC to Parquet.
warc-parquet
๐๏ธ A utility for converting WARC to Parquet.
๐ฆ Install
The binary may be installed via cargo:
$ cargo install warc-parquetTo use the crate in your project, add the following to your Cargo.toml file:
[dependencies]
warc-parquet = "0.6.1"
๐คธ Usage
The Binary
Once installed, the warc-parquet utility can be used to transform WARC into Parquet:
$ wget --warc-file example 'https://example.com'
$ cat example.warc.gz | warc-parquet --gzipped > example.zstd.parquetwarc-parquet is meant to fit organically into the UNIX ecosystem. As such processing multiple WARCs at once is straightforward:
$ wget --warc-file github 'https://github.com'
$ cat example.warc.gz github.warc.gz | warc-parquet --gzipped > combined.zstd.parquetIt's also simple to preprocess via standard UNIX piping:
$ cat example.warc.gz | gzip -d | warc-parquet > example.zstd.parquetVarious compression options, including the option to forego compression altogether, are also available:
$ cat example.warc.gz | warc-parquet --gzipped --compression gzip > example.gz.parquet๐ก
warc-parquet --helpdisplays complete options and usage information.
The Crate
Refer to the docs for more details about how to use the Reader within your own programs.
DuckDB
There are any number of ways to consume Parquet once you have it. However a natural fit might be
DuckDB:
$ duckdb
v0.3.3 fe9ba8003
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D select type, id from 'example.zstd.parquet';
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ type โ id โ
โโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ warcinfo โ <urn:uuid:A8063499-7675-4D8D-A736-A1D7DAE84C84> โ
โ request โ <urn:uuid:3EB20966-D74F-4949-AACB-23DB3A0733A7> โ
โ response โ <urn:uuid:8B92CADC-F770-45BE-8B72-E13A61CD6D1C> โ
โ metadata โ <urn:uuid:4C0E9E17-E21B-49E0-859A-D1016FBDE636> โ
โ resource โ <urn:uuid:14F502A5-3BDE-4D0B-8A43-95F4BB8398C6> โ
โ resource โ <urn:uuid:6B6D6ADD-52FF-4760-AA00-FB9E739CABBE> โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
D describe select * from 'example.zstd.parquet';
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโฌโโโโโโฌโโโโโโโโโโฌโโโโโโโโ
โ column_name โ column_type โ null โ key โ default โ extra โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโผโโโโโโผโโโโโโโโโโผโโโโโโโโค
โ id โ VARCHAR โ YES โ โ โ โ
โ content_length โ UINTEGER โ YES โ โ โ โ
โ date โ TIMESTAMP โ YES โ โ โ โ
โ type โ VARCHAR โ YES โ โ โ โ
โ content_type โ VARCHAR โ YES โ โ โ โ
โ concurrent_to โ VARCHAR โ YES โ โ โ โ
โ block_digest โ VARCHAR โ YES โ โ โ โ
โ payload_digest โ VARCHAR โ YES โ โ โ โ
โ ip_address โ VARCHAR โ YES โ โ โ โ
โ refers_to โ VARCHAR โ YES โ โ โ โ
โ target_uri โ VARCHAR โ YES โ โ โ โ
โ truncated โ VARCHAR โ YES โ โ โ โ
โ warc_info_id โ VARCHAR โ YES โ โ โ โ
โ filename โ VARCHAR โ YES โ โ โ โ
โ profile โ VARCHAR โ YES โ โ โ โ
โ identified_payload_type โ VARCHAR โ YES โ โ โ โ
โ segment_number โ UINTEGER โ YES โ โ โ โ
โ segment_origin_id โ VARCHAR โ YES โ โ โ โ
โ segment_total_length โ UINTEGER โ YES โ โ โ โ
โ body โ BLOB โ YES โ โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโดโโโโโโดโโโโโโโโโโดโโโโโโโโ
๐ฆบ Safety
This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.
๐ฏ Contributing
We appreciate all kinds of contributions, thank you!