Azure Data Lake Storage Gen2
The Azure Data Lake Storage Gen2 origin reads data from Microsoft Azure Data Lake Storage Gen2. The origin can create multiple threads to enable parallel processing in a multithreaded pipeline. Use the origin only in pipelines configured for standalone execution mode. For information about supported versions, see Supported Systems and Versions.
The origin uses the Microsoft Azure Data Lake Storage Gen2 API to request a list of objects located in a storage container or file system and that match a pattern in a directory. As Azure returns pages with the requested objects, the origin launches threads to read and process the data. The objects must be fully written.
After processing an object or upon encountering errors, the origin can keep, archive, or delete the object. When archiving, the origin can move the object.
The origin can generate events for an event stream. For more information about dataflow triggers and the event framework, see Dataflow Triggers Overview.
When you configure the Azure Data Lake Storage Gen2 origin, you specify connection information for Azure Data Lake Storage Gen2, including the storage container or file system and authentication method. You can also use a connection to configure the origin. You also specify the number of objects for Azure to list on a page and the maximum time to wait for Azure to return the requested objects.
You specify information about the objects to read and how to process, including the directory that contains the objects, the matching name pattern, the order to read the objects, the number of threads used to process the data, and the batch size.
You also specify what to do with processed objects and how to handle objects that cannot be processed.
When a pipeline stops, the Azure Data Lake Storage Gen2 origin notes where it stops reading. When the pipeline starts again, the origin continues reading from where it stopped by default. You can reset the origin to read and process all requested objects.
Prerequisites
- If necessary, create a new Azure Active Directory
application for Data Collector.
For information about creating a new application, see the Azure documentation.
- Ensure that the Azure Active Directory Data Collector application
has the appropriate access control to perform the necessary
tasks.
The Data Collector application requires Read and Execute permissions to read data in Azure. If also writing to Azure, the application requires Write permission as well.
For information about configuring Gen2 access control, see the Azure documentation.
- Retrieve information from Azure to configure the origin.
After you complete all of the prerequisite tasks, you can configure the Azure Data Lake Storage Gen2 origin.
Retrieve Authentication Information
The Azure Data Lake Storage Gen2 origin can use different methods to authenticate connections with Azure.
- OAuth with Service Principal
- Connections made with OAuth with Service Principal authentication require
the following information:
- Application ID - Application ID for the Azure Active Directory Data Collector
application. Also known as the client ID.
For information on accessing the application ID from the Azure portal, see the Azure documentation.
- Tenant ID - Tenant ID for the Azure Active Directory
Data Collector application. Also known as the directory ID.
For information on accessing the tenant ID from the Azure portal, see the Azure documentation.
- Application Key - Authentication key or client secret
for the Azure Active Directory application. Also known as the
client secret.
For information on accessing the application key from the Azure portal, see the Azure documentation.
- Application ID - Application ID for the Azure Active Directory Data Collector
application. Also known as the client ID.
- Azure Managed Identity
- Connections made with Azure Managed Identity authentication
require the following information:
- Application ID - Application ID for the Azure Active Directory Data Collector
application. Also known as the client ID.
For information on accessing the application ID from the Azure portal, see the Azure documentation.
- Application ID - Application ID for the Azure Active Directory Data Collector
application. Also known as the client ID.
- Shared Key
- Connections made with Shared Key authentication require the following
information:
- Account Shared Key - Shared access key that Azure
generated for the storage account.
For more information on accessing the shared access key from the Azure portal, see the Azure documentation.
- Account Shared Key - Shared access key that Azure
generated for the storage account.
Common Path, Path Pattern, and Wildcards
The Azure Data Lake Storage Gen2 origin concatenates the common path and the path pattern to define the objects that the origin reads. You can specify an exact path pattern or you can specify an Ant-style path pattern to have the origin read multiple objects recursively.
- Question mark (?) to match a single character
- Asterisk (*) to match zero or more characters
- Double asterisks (**) to match zero or more directories
- Read all log files in all nested directories
- The following table presents two options for configuring the properties to
read all log files in US/East/MD/ and all nested
directories:
Property Option 1 Option 2 Common Path US/East/MD/ US/ Path Pattern **/*.log East/MD/**/*.log - Read all log files in a particular subdirectory
- The following table presents two options for configuring the properties to
read all log files in a weblogs subdirectory nested
anywhere in the hierarchy under US/West:
Property Option 1 Option 2 Common Path US/West/ US/ Path Pattern **/weblogs/*.log West/**/weblogs/*.log
Read Order
The Azure Data Lake Storage Gen2 origin reads objects in ascending order based on the object name or the last modified timestamp. For best performance when reading a large number of objects, configure the origin to read objects based on the object name. Azure always returns objects sorted by name. To read in timestamp order, the origin sorts returned objects by timestamp. Therefore, timestamp ordering requires all objects be returned before the origin starts reading.
- Lexicographically Ascending Names
- The origin reads objects in lexicographically ascending order based on
object names. Lexicographically ascending order reads the numbers 1 through
11 as follows:
1, 10, 11, 2, 3, 4... 9
To read objects with names that sort before already processed objects, reset the origin to read all available objects.
- Last Modified Timestamp
- The origin reads objects in ascending order based on the last modified
timestamp. After Azure returns all objects from a request, the origin sorts
the objects by timestamp and then reads them in chronological order. If two
or more objects have the same timestamp, the origin reads those objects in
lexicographically increasing order by object name.
To read objects that include a timestamp earlier than already processed objects, reset the origin to read all available objects.
Buffer Limit and Error Handling
The Azure Data Lake Storage Gen2 origin uses a buffer to read objects into memory to produce records. The size of the buffer determines the maximum size of the record that can be processed.
The buffer limit helps prevent out-of-memory errors. Decrease the buffer limit when memory on the Data Collector machine is limited. Increase the buffer limit to process larger records when memory is available.
- Discard
- The origin discards the record and all remaining records in the object, and then continues processing the next object.
- Send to Error
- With a buffer limit error, the origin cannot send the record to the pipeline
for error handling because it is unable to fully process the record.
Instead, the origin displays a message indicating that a buffer overrun error occurred in the pipeline history.
If an error container and path are configured for the stage, the origin moves the object to that location and continues processing the next object.
- Stop Pipeline
- The origin stops the pipeline and displays a message indicating that a buffer overrun error occurred. The message includes the object and offset where the buffer overrun error occurred. The information displays in the pipeline history.
Multithreaded Processing
The Azure Data Lake Storage Gen2 origin uses multiple concurrent threads to process data based on the Number of Threads property.
Each thread reads data from a single object, and each object can have a maximum of one thread read from it at a time. The object read order is based on the configuration for the Read Order property.
As the pipeline runs, each thread connects to the origin system, creates a batch of data, and passes the batch to an available pipeline runner. A pipeline runner is a sourceless pipeline instance - an instance of the pipeline that includes all of the processors, executors, and destinations in the pipeline and handles all pipeline processing after the origin.
Each pipeline runner processes one batch at a time, just like a pipeline that runs on a single thread. When the flow of data slows, the pipeline runners wait idly until they are needed, generating an empty batch at regular intervals. You can configure the Runner Idle Time pipeline property to specify the interval or to opt out of empty batch generation.
Multithreaded pipelines preserve the order of records within each batch, just like a single-threaded pipeline. But since batches are processed by different pipeline runners, the order that batches are written to destinations is not ensured.
For example, suppose you configure the origin to use five threads to read objects in the order of last-modified timestamp. When you start the pipeline, the origin creates five threads, and Data Collector creates a matching number of pipeline runners.
The origin assigns a thread to each of the five oldest objects. Each thread processes its assigned object, passing batches of data to the origin. Upon receiving data, the origin passes a batch to each of the pipeline runners for processing.
After a thread completes processing an object, the origin assigns the thread to the next object based on the last-modified timestamp, until all objects are processed.
For more information about multithreaded pipelines, see Multithreaded Pipeline Overview.
Record Header Attributes
When the Azure Data Lake Storage Gen2 origin processes Avro data, it includes the Avro schema in
an avroSchema
record header attribute. When the origin processes Parquet data and Skip Union Indexes is
not enabled, it generates an avro.union.typeIndex./id
record header attribute identifying the index number of the
element in a union the data is read from.
You can also configure the origin to include Azure Data Lake Storage Gen2 object metadata in record header attributes.
You can use the record:attribute
or
record:attributeOrDefault
functions to access the information
in the attributes. For more information about working with record header attributes,
see Working with Header Attributes.
Object Metadata in Record Header Attributes
You can include Azure Data Lake Storage Gen2 object metadata in record header attributes. Include metadata when you want to use the information to help process records. For example, you might include metadata if you want to route records to different branches of a pipeline based on the last-modified timestamp.
- System-defined metadata
- The origin includes the following system-defined metadata:
- Creation-Time
- Last-Modified
- Etag
- Content-Length
- Content-Encoding
- Content-Language
- Content-MD5
- Content-Disposition
- Cache-Control
- Custom metadata
- The origin includes the following custom metadata:
- container
- objectKey
- file
- filename
- mtime
- size
- owner
- permissions
- continuationToken
For more information about record header attributes, see Record Header Attributes.
Event Generation
The Azure Data Lake Storage Gen2 origin can generate events that you can use in an event stream. With event generation enabled, the origin generates event records each time the origin starts or completes reading an object and after the configured batch wait time has elapsed following all processing of the available data.
- With the Pipeline Finisher executor to
stop the pipeline and transition the pipeline to a Finished state when
the origin completes processing available data.
When you restart a pipeline stopped by the Pipeline Finisher executor, the origin continues processing from the last-saved offset unless you reset the origin.
For an example, see Stopping a Pipeline After Processing All Available Data.
- With a destination to store event information.
For an example, see Preserving an Audit Trail of Events.
Event Records
Record Header Attribute | Description |
---|---|
sdc.event.type | Event type. Uses one of the following types:
|
sdc.event.version | Integer that indicates the version of the event record type. |
sdc.event.creation_timestamp | Epoch timestamp when the stage created the event. |
- new-file
- The Azure Data Lake Storage Gen2 origin generates a new-file event record when it starts processing a new object.
- finished-file
- The Azure Data Lake Storage Gen2 origin generates a finished-file event record when it finishes processing an object.
- no-more-data
- The Azure Data Lake Storage Gen2 origin generates a no-more-data event record when the origin completes processing all available records and the number of seconds configured for Batch Wait Time elapses without any new objects appearing to be processed.
Data Formats
- Avro
- Generates a record for every Avro record. Includes a
precision
andscale
field attribute for each Decimal field. - Delimited
- Generates a record for each delimited line.
- Excel
- Generates a record for every row in the file. Can process
.xls
or.xlsx
files.You can configure the origin to read from all sheets in a workbook or from particular sheets in a workbook. You can specify whether files include a header row and whether to ignore the header row. You can also configure the origin to skip cells that do not have a corresponding header value. A header row must be the first row of a file. Vertical header columns are not recognized.
The origin cannot process Excel files with large numbers of rows. You can save such files as CSV files in Excel, and then use the origin to process with the delimited data format.
- JSON
- Generates a record for each JSON object. You can process JSON files that include multiple JSON objects or a single JSON array.
- Log
- Generates a record for every log line.
- Parquet
- The origin generates records for every Parquet record in the file.
The file must contain the Parquet schema. The origin uses the
Parquet schema to generate records.
The stage includes the Parquet schema in a
parquetSchema
record header attribute.When Skip Union Indexes is not enabled, the origin generates an
avro.union.typeIndex./id
record header attribute identifying the index number of the element in the union that the data is read from. If a schema contains many unions and the pipeline does not depend on index information, you can enable Skip Union Indexes to avoid long processing times associated with storing a large number of indexes. - Protobuf
- Generates a record for every protobuf message.
- SDC Record
- Generates a record for every record. Use to process records generated by a Data Collector pipeline using the SDC Record data format.
- Text
- Generates a record for each line of text or for each section of text based on a custom delimiter.
- Whole File
- Streams whole files from the origin system to the destination system. You can specify a transfer rate or use all available resources to perform the transfer.
- XML
- Generates records based on a user-defined delimiter element. Use an XML element directly under the root element or define a simplified XPath expression. If you do not define a delimiter element, the origin treats the XML file as a single record.
Configuring an Azure Data Lake Storage Gen2 Origin
Configure an Azure Data Lake Storage Gen2 origin to read data from Microsoft Azure Data Lake Storage Gen2. Be sure to complete the necessary prerequisites before you configure the origin.