pyarrow.parquet.read_schema#

pyarrow.parquet.read_schema(where,memory_map=False,decryption_properties=None,filesystem=None)[source]#

Read effective Arrow schema from Parquet file metadata.

Parameters:
wherestr (file path) or file-like object
memory_mapbool, defaultFalse

Create memory map when the source is a file path.

decryption_propertiesFileDecryptionProperties, defaultNone

Decryption properties for reading encrypted Parquet files.

filesystemFileSystem, defaultNone

If nothing passed, will be inferred based on path.Path will try to be found in the local on-disk filesystem otherwiseit will be parsed as an URI to determine the filesystem.

Returns:
schemapyarrow.Schema

The schema of the Parquet file

Examples

>>>importpyarrowaspa>>>importpyarrow.parquetaspq>>>table=pa.table({'n_legs':[4,5,100],...'animal':["Dog","Brittle stars","Centipede"]})>>>pq.write_table(table,'example.parquet')
>>>pq.read_schema('example.parquet')n_legs: int64animal: string