Skip to main content
Preview A table-valued function (TVF) that reads data from Vortex files in object storage. The function can use either a location object (recommended) or direct credentials to access the data. READ_VORTEX returns a table with data from the specified Vortex files.

Syntax

When you pass 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 URL can be passed as either the first positional parameter or a named parameter
    • If you provide either AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY, you must provide both
    • Providing an AWS session token is optional
    • Credentials are not required for accessing public buckets
  • The URL also accepts the upload:// scheme to read a file sent in the same HTTP request. See Upload and query local files.
  • Where local file system access is enabled, the URL can be a local path: absolute, relative to the engine’s working directory, or prefixed with file://.

Return type

The result is a table with data from the Vortex files. Without SCHEMA, columns are read using data types inferred from the Vortex schema, and all columns are nullable.
When loading multiple files, Firebolt infers the schema from the most recently modified file. The remaining files must have compatible data types. If columns or types differ between files, pass an explicit SCHEMA.

Explicit schema

With SCHEMA, every file is read into the declared columns:
  • Columns are matched to file columns by name, case-sensitively. File columns not in the schema are not read.
  • A declared column that is absent from a file reads as NULL for that file’s rows. If the column is declared NOT NULL, it reads as its type’s zero value (0, '', false) instead.
  • A declared struct field that is absent from the file’s struct reads the same way.
  • A column whose declared type differs from the file’s type is cast to the declared type. A value that cannot be cast fails the query.

Best practice

Firebolt recommends using a LOCATION object to store credentials for authentication. When using READ_VORTEX(), the URL parameter in the location should contain only Vortex files (see location table-valued functions).

Examples

Example The following code example reads the first 5 rows from Vortex files using a LOCATION object to store credentials for authentication:
Example: Using location object with pattern
This reads only the Vortex files matching the pattern 2025-*/*.vortex within the location’s base path. Example: Reading files with differing columns into one schema old.vortex has columns id and name; new.vortex has id, name, and score. The declared schema covers both, and score is NULL for rows from old.vortex:

Using URL

  • The URL can be passed as either the first positional parameter or a named parameter. For example, the following two queries both read the same file:
  • The URL can represent a single file or a glob pattern. If a glob pattern is used, all files matching the pattern are read. The special column $source_file_name identifies the source file of each row in the result set:
When using glob patterns, the wildcard (*) can only be used at the end of the path. You can use it with any text before or after, such as *.vortex, date=2025*.vortex, or data_*.vortex. The pattern recursively matches files in all subdirectories.