Conteúdo do Curso
Introduction to Data Engineering with Azure
Introduction to Data Engineering with Azure
Lookup Activity
The Lookup Activity in Azure Data Factory is a versatile tool that retrieves data from a specified source, such as a database, blob storage, or a data lake. It allows you to fetch single or multiple rows of data to use dynamically in your pipelines. This makes it ideal for use cases like conditional processing, dynamic configuration, or filtering data based on specific patterns.
It connects to a data source and executes a query to fetch data. The output can be used as input for other activities in the pipeline, enabling dynamic and flexible workflows. For example, you can retrieve a list of regions from a database and use them to trigger region-specific tasks.
How to Use Lookup Activity
- Drag the Lookup Activity onto your pipeline canvas in Azure Data Factory Studio;
- Link the activity to a Linked Service that points to your data source;
- In the Source Dataset field, select or create a dataset that represents your data source;
- Configure the Query field by writing a SQL query (for databases) or specifying a file path/pattern (for files);
- Decide whether to retrieve a single row or multiple rows by adjusting the First Row Only option in the activity settings;
- Use the output dynamically in subsequent activities by referencing it with expressions like
@activity('LookupActivityName').output.value
.
When you configure the Lookup Activity in Azure Data Factory with the "Use First Row Only" option, it ensures that only the first row of the query result is retrieved. This setup is particularly useful when you need a single data point or record to drive subsequent activities in your pipeline.
Once the Lookup Activity is configured, you can reference its first-row output in subsequent activities using the following expression: @activity('LookupActivityName').output.firstRow
.
Obrigado pelo seu feedback!