Skip to main content
The data pipeline loading infrastructure enables the loading of certain metadata values of a source record into the System. Metadata represents information about a record that is not represented in the record data itself, e.g., the filename of the source record or the timestamp when a record was created in . You can also load data in partitioned files using naming standards with a filter set in the file path. Syntaxes The METADATA function can load a variety of metadata along with each record of the data pipeline, or it can use key-value pairs to return the value in the filename metadata. Load Metadata into a Column To load a metadata value into a column, use the METADATA function in the SELECT SQL statement and replace key with the key you want to load. You can use transformation functions to achieve the final data type or allow the pipeline to apply automatic casting.
SQL
METADATA(key)
ArgumentData TypeDescription
keystringThe name of the specified metadata key. Example: 'topic'
Retrieve a Value from Filename Metadata To retrieve a value from a key-value pair in the filename metadata, specify the first argument as 'hive_partition' and provide a search string for the key. In this case, the filename must follow Hive naming standards. The standard embeds field names and key-value pairs in path segments, such as /year=2019/month=2/data.parquet. If there are duplicate key-value pairs in the filename, the function uses the last pair. The function returns a string with the value of the associated key, and returns NULL if the file does not contain the search string or the filename does not follow Hive naming standards.
SQL
METADATA('hive_partition',search_string)
ArgumentData TypeDescription
search_stringstringThe search string to use as a key for searching the filename metadata to return the value from the key-value pair as a string.
Loads a variety of header metadata along with each record of the data pipeline.
SQL
METADATA('header', header_row_index, header_col_index)
ArgumentData TypeDescription
header_row_indexintegerThe index, which starts at 1, of the header row to load.
header_col_indexintegerThe index, which starts at 1, of the header column to load.
Metadata fields cannot be combined in a transformation function with other source data.
Supported Values for the Metadata Key The metadata values you can load differ based on the source type. This table lists the available values for the metadata keys specified using the key argument by source type and their returned data type. Metadata key values are not case-sensitive.
Metadata KeySource TypeReturned Value Data TypeDescription
row_idFile Load and Kafka LoadUUIDA unique row identifier that is generated by the Ocient System during loading. The Ocient System guarantees this identifier is unique for each loaded record because the generation is based on internal mechanisms that enforce record deduplication.
filenameFile LoadVARCHARThe filename and full file path indicate the source of the record.
file_modified_timestampFile LoadTIMESTAMPThe timestamp that indicates when the file was last modified on the data source.
headerDelimited File LoadVARCHARReturns the string representation of the header field for the specified header row and column.

Returns NULL if any of these conditions exist:

The specified field is not present.

The specified field is empty, and the EMPTY_FIELD_AS_NULL delimited extract option is set to true.

The specified field matches one of the strings in the NULL_STRINGS delimited extract option.
keyKafka LoadVARBINARYThe bytes of the Kafka key for the record.
line_numberFile LoadBIGINTThe line number in the file for the source of the record.
offsetKafka LoadBIGINTThe Kafka offset of the record.
partitionKafka LoadBIGINTThe name of the Kafka partition that indicates the source of the record.
recordFile and Kafka LoadVARCHARThe string representation of the full record. For delimited, JSON, and binary formats, the system represents the record in the same way as the source. For XML, ASN.1, and formats, the system represents the record as a JSON object.
record_timestampKafka LoadTIMESTAMPThe timestamp that indicates when the record was created in the Kafka Broker.
source_record_idFile and Kafka LoadUUIDA unique source row identifier that is generated by the Ocient System during loading. The Ocient System guarantees this unique identifier for each source record with a specific SOURCE and EXTRACT configuration because the generation is based on source names, source record numbers, and source record offsets.
topicKafka LoadVARCHARThe name of the Kafka topic that indicates the source of the record.
Examples Load Filename Metadata This example snippet uses the CREATE PIPELINE SQL statement to load data and the source filename with each record in a pipeline. For details about this pipeline definition and setup, see Data Pipeline Load of CSV Data from S3.
SQL
CREATE PIPELINE orders_pipeline
SOURCE
    S3
        ENDPOINT 'https://s3.us-east-1.amazonaws.com'
        BUCKET 'ocient-docs'
        FILTER 'metabase_samples/csv/orders.csv'
EXTRACT
    FORMAT csv
    NUM_HEADER_LINES 1
INTO public.orders
SELECT
    $1 as id,
    $2 as user_id,
    $3 as product_id,
    $4 as subtotal,
    $5 as tax,
    $6 as total,
    $7 as discount,
    $8 as created_at,
    $9 as quantity,
    METADATA('filename') AS filename_column;
Load Hive-Style Partitioned Data This example uses the CREATE PIPELINE SQL statement to load data and the value of the search string 'year' of the filename with each record in a pipeline. The S3 FILTER option contains the filter for the year in a file path. In turn, the METADATA function uses the filter 'year' value to load all records from files with the year 2019 in the specified path. For details about this pipeline definition and setup, see Data Pipeline Load of CSV Data from S3. The example assumes the filename follows Hive-style naming standards.
SQL
CREATE PIPELINE orders_pipeline
SOURCE
    S3
        ENDPOINT 'https://s3.us-east-1.amazonaws.com'
        BUCKET 'ocient-docs'
        FILTER '/year=2019/**'
EXTRACT
    FORMAT csv
    NUM_HEADER_LINES 1
INTO public.orders
SELECT
    $1 as id,
    $2 as user_id,
    $3 as product_id,
    $4 as subtotal,
    $5 as tax,
    $6 as total,
    $7 as discount,
    $8 as created_at,
    $9 as quantity,
    METADATA('hive_partition','year') AS hive;
Load Data CREATE PIPELINE Transform Data in Data Pipelines
Last modified on May 27, 2026