metadata$file_row_number is a Snowflake staged-file metadata column that records the row number of each record within its source file. It can be selected during ingestion and retained in a target table when source ordering matters. section 2.3
Use the column to:
- Identify a record’s position in its individual source file. section 2.3 section 3.4.1
- Preserve source ordering information when loading records into a target table. section 2.3
- Expose file-position metadata alongside parsed columns in an external table. section 3.4.1
Selecting the source row number
Query staged records with their source position, for example: SELECT $1, $2, $3, $4, $5, metadata$file_row_number AS source_row_number FROM @ORDERS_STAGE; section 2.3
