Microsoft Azure Data Lake Storage Gen2 Connector > Mappings for Microsoft Azure Data Lake Storage Gen2 > FileName field
  

FileName field

A FileName field is a string field that contains the source path of a file. The default precision for a FileName field is 255 characters for a flat file and 1024 characters for a complex file.
You cannot configure the FileName field. You can delete the FileName field if you do not want to read or write the data in the FileName field. You cannot create a folder name with more than 255 characters for a flat file and 1024 characters for a complex file.
FileName is a reserved keyword. Avoid using FileName as the column name in the source data. The name is case sensitive.
The FileName field is applicable to the following file formats:

Reading source objects path

When you import source objects, the Secure Agent appends a FileName field to the imported source object. The FileName field stores the absolute path of the source file from which the Secure Agent reads the data at run time.
For example, a directory contains a number of files and each file contains multiple records that you want to read. You select the directory as source type in the Microsoft Azure Data Lake Storage Gen2 source advanced properties. When you run the mapping, the Secure Agent reads each record and stores the absolute path of the respective source file in the FileName field.
When you use the FileName field in a source object, the Secure Agent reads file names differently for mappings in advanced mode.
Format type
Syntax
Example
Complex file
abfss://<filesystem_name>@<account name>.<endpoint>/<directory>/<source_file_name>
abfss://adapterqa-source@adlsgen2qa.dfs.core.windows.net/parquet/reader/customer.parquet
Flat file
<directory>/<source_file_name>
csv/customer.csv

Writing to target objects

When you import target objects, the Secure Agent appends a FileName field to the imported target object. When you map the FileName field in the target object to an incoming field, the Secure Agent creates the folder structure and the target files based on the FileName field.
The following table describes how the Secure Agent reads file names for mappings:
Format type
Syntax
Example
Complex file
<directory>/<target_file_name>/<target_file_name>=<values of filename field>/part_file
parquet/writer/customer.parquet/customer.parquet=1
Flat file
<directory>/<target_file_name>/<target_file_name>=<values of filename field>/part_file
This syntax is applicable only to mappings.
If you create a mapping in advanced mode, the Secure Agent does not create a directory structure.
csv/customer.csv/customer.csv=1
The following table describes the syntax and example for the FileName field scenarios in mappings:
Description
Syntax
Example
When there is no target, a new target file is created.
<target_file_name>=<source_file_name>
customer_tgt.csv=customer_src.csv
When the FileName field of an source is mapped to the FileName field of an existing target, a new target file is created and the existing target is not affected.
<target_file_name>=<source_field_value>
customer_tgt.csv=customer_src.csv
When a source field other than the FileName field is mapped to the FileName field of an existing target, separate files are created for each unique value of the source field.
<target_file_name>=<source_field_value>
customer_tgt.csv=a, customer_tgt.csv=b... customer_tgt.csv=n
In the example, n number of files are inserted into the directory where the target file is present. Where, n equals the number of unique values of the source field.

Rules and guidelines for FileName field

Consider the following guidelines when you use the FileName field in mappings: