- Installation
- Guides
- Overview
- Data Import & Export
- CSV Import
- CSV Export
- Parquet Import
- Parquet Export
- Querying Parquet Files
- HTTP Parquet Import
- S3 Parquet Import
- S3 Parquet Export
- S3 Iceberg Import
- JSON Import
- JSON Export
- Excel Import
- Excel Export
- SQLite Import
- PostgreSQL Import
- Meta Queries
- ODBC
- Python
- Installation
- Execution SQL
- Jupyter Notebooks
- SQL on Pandas
- Import from Pandas
- Export to Pandas
- SQL on Arrow
- Import from Arrow
- Export to Arrow
- Relational API on Pandas
- Multiple Python Threads
- Integration with Ibis
- Integration with Polars
- Using fsspec Filesystems
- SQL Features
- SQL Editors
- Data Viewers
- Documentation
- Connect
- Data Import
- Overview
- CSV Files
- JSON Files
- Multiple Files
- Parquet Files
- Partitioning
- Appender
- INSERT Statements
- Client APIs
- Overview
- C
- Overview
- Startup
- Configuration
- Query
- Data Chunks
- Values
- Types
- Prepared Statements
- Appender
- Table Functions
- Replacement Scans
- API Reference
- C++
- CLI
- Go
- Java
- Julia
- Node.js
- Python
- Overview
- Data Ingestion
- Result Conversion
- DB API
- Relational API
- Function API
- Types API
- Expression API
- Spark API
- API Reference
- Known Python Issues
- R
- Rust
- Swift
- Wasm
- ADBC
- ODBC
- SQL
- Introduction
- Statements
- Overview
- ALTER TABLE
- ALTER VIEW
- ATTACH/DETACH
- CALL
- CHECKPOINT
- COPY
- CREATE INDEX
- CREATE MACRO
- CREATE SCHEMA
- CREATE SEQUENCE
- CREATE TABLE
- CREATE VIEW
- CREATE TYPE
- DELETE
- DROP
- EXPORT/IMPORT DATABASE
- INSERT
- PIVOT
- Profiling
- SELECT
- SET/RESET
- Transaction Management
- UNPIVOT
- UPDATE
- USE
- VACUUM
- Query Syntax
- SELECT
- FROM & JOIN
- WHERE
- GROUP BY
- GROUPING SETS
- HAVING
- ORDER BY
- LIMIT
- SAMPLE
- Unnesting
- WITH
- WINDOW
- QUALIFY
- VALUES
- FILTER
- Set Operations
- Prepared Statements
- Data Types
- Overview
- Array
- Bitstring
- Blob
- Boolean
- Date
- Enum
- Interval
- List
- Map
- NULL Values
- Numeric
- Struct
- Text
- Time
- Timestamp
- Time Zones
- Union
- Expressions
- Overview
- CASE statement
- Casting
- Collations
- Comparisons
- IN Operator
- Logical Operators
- Star Expression
- Subqueries
- Functions
- Overview
- Bitstring Functions
- Blob Functions
- Date Format Functions
- Date Functions
- Date Part Functions
- Enum Functions
- Interval Functions
- Nested Functions
- Numeric Functions
- Pattern Matching
- Text Functions
- Time Functions
- Timestamp Functions
- Timestamp with Time Zone Functions
- Utility Functions
- Aggregate Functions
- Configuration
- Constraints
- Indexes
- Information Schema
- Metadata Functions
- Pragmas
- Rules for Case Sensitivity
- Samples
- Window Functions
- Extensions
- Development
- DuckDB Repositories
- Testing
- Internals Overview
- Storage Versions & Format
- Execution Format
- Profiling
- Release Dates
- Building
- Benchmark Suite
- Sitemap
- Why DuckDB
- Media
- FAQ
- Code of Conduct
- Live Demo
Parquet Metadata
The parquet_metadata
function can be used to query the metadata contained within a Parquet file, which reveals various internal details of the Parquet file such as the statistics of the different columns. This can be useful for figuring out what kind of skipping is possible in Parquet files, or even to obtain a quick overview of what the different columns contain.
SELECT * FROM parquet_metadata('test.parquet');
Below is a table of the columns returned by parquet_metadata
.
Field | Type |
---|---|
file_name |
VARCHAR |
row_group_id |
BIGINT |
row_group_num_rows |
BIGINT |
row_group_num_columns |
BIGINT |
row_group_bytes |
BIGINT |
column_id |
BIGINT |
file_offset |
BIGINT |
num_values |
BIGINT |
path_in_schema |
VARCHAR |
type |
VARCHAR |
stats_min |
VARCHAR |
stats_max |
VARCHAR |
stats_null_count |
BIGINT |
stats_distinct_count |
BIGINT |
stats_min_value |
VARCHAR |
stats_max_value |
VARCHAR |
compression |
VARCHAR |
encodings |
VARCHAR |
index_page_offset |
BIGINT |
dictionary_page_offset |
BIGINT |
data_page_offset |
BIGINT |
total_compressed_size |
BIGINT |
total_uncompressed_size |
BIGINT |
key_value_metadata |
MAP(BLOB, BLOB) |
Parquet Schema
The parquet_schema
function can be used to query the internal schema contained within a Parquet file. Note that this is the schema as it is contained within the metadata of the Parquet file. If you want to figure out the column names and types contained within a Parquet file it is easier to use DESCRIBE
.
-- fetch the column names and column types
DESCRIBE SELECT * FROM 'test.parquet';
-- fetch the internal schema of a Parquet file
SELECT * FROM parquet_schema('test.parquet');
Below is a table of the columns returned by parquet_schema
.
Field | Type |
---|---|
file_name |
VARCHAR |
name |
VARCHAR |
type |
VARCHAR |
type_length |
VARCHAR |
repetition_type |
VARCHAR |
num_children |
BIGINT |
converted_type |
VARCHAR |
scale |
BIGINT |
precision |
BIGINT |
field_id |
BIGINT |
logical_type |
VARCHAR |
Parquet File Metadata
The parquet_file_metadata
function can be used to query file-level metadata such as the format version and the encryption algorithm used.
SELECT * FROM parquet_file_metadata('test.parquet');
Below is a table of the columns returned by parquet_file_metadata
.
Field | Type |
---|---|
file_name |
VARCHAR |
created_by |
VARCHAR |
num_rows |
BIGINT |
num_row_groups |
BIGINT |
format_version |
BIGINT |
encryption_algorithm |
VARCHAR |
footer_signing_key_metadata |
VARCHAR |
Parquet Key-Value Metadata
The parquet_kv_metadata
function can be used to query custom metadata defined as key-value pairs.
SELECT * FROM parquet_kv_metadata('test.parquet');
Below is a table of the columns returned by parquet_kv_metadata
.
Field | Type |
---|---|
file_name |
VARCHAR |
key |
BLOB |
value |
BLOB |