READ_DUCKLAKE connects to the catalog, resolves the requested table and snapshot, and returns a table with the data from that snapshot.
The function can use either a location object or individual TVF parameters to access the catalog and data.
To inspect the underlying data files of a DuckLake table without reading the row data, use LIST_DUCKLAKE_FILES.
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
Using a LOCATION object
For syntax details, see CREATE LOCATION (DuckLake).
Using individual TVF parameters
Amazon S3 parameters
Use these parameters to authenticate to the object storage that holds the Parquet data files. They apply only to the individual-parameter call shape; with a location object, store credentials in the location instead.Return type
The result is a table with the data from the requested DuckLake snapshot. Columns are read using the data types defined in the DuckLake catalog, mapped to the corresponding Firebolt types. See Supported data types.Best practices
- Use a
LOCATIONobject to store the catalog connection string and credentials. The connection string typically contains a password, and a location object centralizes credential management so you don’t repeat secrets in every query. See CREATE LOCATION (DuckLake). - Use views to simplify repeated queries. Wrap
READ_DUCKLAKEin a view so you can query a DuckLake table without repeating the TVF call. See Simplifying queries with views. - Pin a
SNAPSHOT_IDfor reproducible reads. By default Firebolt reads the latest snapshot. SpecifySNAPSHOT_IDwhen you need a stable, repeatable view of the data. - Specify all parameters using the named-parameter syntax (
TABLE => 'my_table') rather than relying on parameter positions.
How inlined data is handled
DuckLake doesn’t always write new rows to Parquet files. To keep small or frequent writes cheap, it can inline them — storing the rows directly in the catalog database (PostgreSQL) instead of flushing them to a Parquet data file. DuckLake decides this when it writes the data, based on itsdata_inlining_row_limit setting, which you configure on the DuckLake side when you attach the catalog. Firebolt never writes to DuckLake, so it doesn’t control inlining; it only reads whatever the catalog describes.
READ_DUCKLAKE reads inlined rows transparently. A single call returns the complete table at the requested snapshot — both the rows in Parquet files and the rows inlined in the catalog — so you don’t query inlined tables any differently.
Two behaviors follow from this:
LIST_DUCKLAKE_FILESdoesn’t report inlined rows. It lists Parquet data files, and inlined rows have no file. A table can therefore return more rows fromREAD_DUCKLAKEthan the file record counts inLIST_DUCKLAKE_FILESadd up to.- Metadata pseudo-columns use sentinel values for inlined rows. Inlined rows have no source file, so for those rows
$source_file_name(and the otherTEXTsource pseudo-columns) returns'inlined', and$source_file_row_numberreturns0.
Firebolt currently reads at most one inlined data table per DuckLake table. Schema evolution can leave inlined rows spread across more than one catalog table (one per schema version); reading such a table fails with
Expected exactly one inlined data table. Multiple inlined data tables are not supported yet.Inspecting the plan
When a table has inlined data,READ_DUCKLAKE plans as a union of two branches:
- A Parquet branch —
read_from_s3over the data files, with a positional-delete filter, fed bylist_ducklake_filesfor the file metadata and statistics. - An inlined-data branch —
read_ducklake_inlined_data, which reads the rows directly from the catalog database.
EXPLAIN (PHYSICAL) to see both branches. The output below is abbreviated — the read_from_s3 arguments, the list_ducklake_files column list, and the [Types] annotations are trimmed for readability:
[Union] node (3) combines the two sources. The first branch (nodes 4–8) reads and delete-filters the Parquet files; the second branch (nodes 9–10) reads the inlined rows from PostgreSQL. The [MaybeCache] nodes cache the metadata and data subresults so that repeated reads of the same snapshot can skip the work. When a table has no inlined data, the [Union] and the read_ducklake_inlined_data branch don’t appear, and the plan is just the Parquet branch.
Examples
Reading using a LOCATION
The following example creates a location object that stores the catalog connection string and storage credentials, then reads from a table:LOCATION, see CREATE LOCATION (DuckLake).
Reading a specific snapshot
Reading with individual parameters
When the data files live on a local filesystem (for example, a Firebolt Core deployment with on-disk Parquet files), pass the catalog connection string directly and omit the S3 parameters:Simplifying queries with views
You can wrapREAD_DUCKLAKE in a view for easier querying. This also works with LOCATION-based calls.
READ_DUCKLAKE directly. For more information about views, see CREATE VIEW.
Inspecting the query plan
UseEXPLAIN (ANALYZE) to see how Firebolt reads the DuckLake table, including how metadata and data caching behave across repeated runs:
Supported data types
Firebolt maps DuckLake column types to Firebolt types as follows.
The following DuckLake types are currently not supported. Reading a table that contains one of these types fails with an error:
- Integers wider than Firebolt supports:
uint64,int128,uint128. - Time and sub-second/extended timestamp types:
time,timetz,timestamp_s,timestamp_ms,timestamp_ns,interval. json,uuid, andvariant.- Nested
structandmaptypes. (Nestedlistcolumns are supported and read asARRAY.) - Geometry types, including
point,linestring,polygon,multipoint,multilinestring,multipolygon,linestring_z, andgeometrycollection.
Limitations
- Only PostgreSQL DuckLake catalogs are supported. The data files must be Parquet.
- Reads are read-only. Firebolt does not write to or modify DuckLake tables.
- See Supported data types for the column types that cannot currently be read.
- Firebolt reads at most one inlined data table per DuckLake table. See How inlined data is handled.
Related
- CREATE LOCATION (DuckLake) — Store the catalog connection string and credentials in a reusable location object instead of passing them on every call.
- LIST_DUCKLAKE_FILES — List the Parquet data files behind a DuckLake table, with per-file metadata and statistics.
- DuckLake functions overview — All DuckLake functions in one place.
- Query DuckLake tables with Firebolt Core — A step-by-step guide to setting up a DuckLake catalog and reading it from Firebolt.