READ_PARQUET returns a table with data from the specified Parquet file.
Syntax
AWS_ROLE_ARN, set the optional AWS_ROLE_EXTERNAL_ID to add a customer-controlled condition to your role’s trust policy.
For role-based AWS access you can additionally set an external ID. An external ID is a value you choose and control that AWS checks when Firebolt assumes your role, adding a second condition on top of your account’s unique IAM principal. Configuring one is a recommended best practice. See IAM roles.
Parameters
- When using static credentials:
- The
URLcan be passed as either the first positional parameter or a named parameter - If you provide either
AWS_ACCESS_KEY_IDorAWS_SECRET_ACCESS_KEY, you must provide both - Providing an AWS session token is optional
- Credentials are not required for accessing public buckets
- The
- The
URLalso accepts theupload://scheme to read a file sent in the same HTTP request. See Upload and query local files.
Return Type
The result is a table with data from the Parquet files. Columns are read and parsed using their inferred data types.When loading multiple files, Firebolt infers the schema from the most recently modified file. The remaining files must have compatible data types. If types vary between files (e.g., a column contains integers in one file but doubles in another, or is numeric in one file but text in another), the inferred schema may not match all files and thus cause data type errors or query failures. In such cases, we recommend defining an explicit schema using either external tables or
COPY FROM into existing tables.Best practice
Firebolt recommends using aLOCATION object to store credentials for authentication.
When using READ_PARQUET(), the URL parameter in the location should contain only parquet files (see location table-valued functions).
Examples
Example The following code example reads the first 5 rows from a Parquet file using aLOCATION object to store credentials for authentication:
PATTERN parameter with a location object to filter specific files:
This reads only the Parquet files matching the pattern
playstats/TournamentID=92/*.parquet within the location’s base path, showing specific columns and the source file for verification.
Example
The following code example reads the first 5 rows from a Parquet file using static credentials for authentication:
Using URL
- The
URLcan be passed as either the first positional parameter or a named parameter. For example, the following two queries will both read the same file: - Credentials are optional.
- The
urlcan represent a single file or a glob pattern. If a glob pattern is used, all files matching the pattern will be read. A special column$source_file_namecan be used to identify the source file of each row in the result set:
*) can only be used at the end of the path. You can use it with any text before or after, such as *.parquet, date=2025*.parquet, or data_*.parquet.
The pattern will recursively match files in all subdirectories. For example:
help_center_assets/firebolt_sample_dataset/playstats/*.parquet.
The column $source_file_name can be used in combination with REGEXP_EXTRACT to extract data from the source file path. The following code returns the TournamentID for each record it reads based on its file path:
92 for records in file s3://firebolt-publishing-public/help_center_assets/firebolt_sample_dataset/playstats/TournamentID=92/cc2a2a0b4e8b4fb39abf20a956e7cc3e-0.parquet.