Skip to main content

ADF - ingestion from website and from the storage blog

 


in ECDC website the reports are providing in the weekly instead of daily so for the easy access authir gave the csv files in the git hub repository.





Always review the data before ingestion to understand its structure and contents.






test the connection and click on create.


now the linked services created.

create one new dataset .



  • Name: ds_cases_deaths_raw_csv_http - This is the unique identifier for this dataset within ADF. The naming convention suggests it's for raw CSV data related to cases and deaths, retrieved via HTTP.

  • Linked service: ls_http_opendata_ecdc_europa_eu - This is the connection information that tells ADF where to find the data. In this case, it's an HTTP linked service, pointing to a public data source from ECDC (European Centre for Disease Prevention and Control). The pencil icon next to it indicates it can be edited.

  • Relative URL: covid19/nationalcasedeath/csv/covid19/raw/main/ecdc_data/cases_deaths.csv - This is the specific path to the CSV file relative to the base URL defined in the linked service. It points to a file named cases_deaths.csv within a nested folder structure related to COVID-19 data. This suggests that the data is publicly available COVID-19 statistics.

  • First row as header: This checkbox is selected (indicated by the checkmark). This means that ADF will treat the first row of the cases_deaths.csv file as column headers, not as data. This is crucial for correct schema inference and data mapping.

  • Import schema:

    • From connection/store: This option is selected. ADF will try to infer the schema (column names and data types) directly from the CSV file based on the first row (headers) and data samples. This is common for initial setup.

    • From sample file: (Not selected) - You could provide a separate sample file to infer the schema from.

    • None: (Not selected) - You would manually define the schema.

In essence, this dataset defines how to access a specific CSV file containing COVID-19 cases and deaths data, located on an HTTP server managed by ECDC, and how to interpret its structure (first row as headers, schema inferred).

now create another dataset ..





then click ok dataset is created .



create the copy activity copying the dataset from the http server to sink dataset.









🔹 Parameters vs Variables in ADF

FeatureParametersVariables
ScopePipeline levelPipeline level
MutabilityImmutable (can't change after set)Mutable (can change during pipeline)
Use CasesInput values for pipelineTemporary storage during pipeline

🔹 Using Parameters

1. Define Parameters

Go to the pipeline → Parameters tab → Click + New to add a parameter.

plaintext

Name: myParam Type: String Default value: optional

2. Pass Parameters to Activities

For example, in a Copy Data activity:

  • Go to the Source or Sink.

  • In the dynamic content box (click the "Add dynamic content" link), you can use:


@pipeline().parameters.myParam

You can also pass parameters to datasets or linked services.

3. Pass Parameters When Triggering a Pipeline

When running a pipeline manually or via another pipeline (using Execute Pipeline), you can provide parameter values.


🔹 Using Variables

1. Define Variables

In the pipeline → Variables tab → Click + New.

plaintext

Name: myVar Type: String / Boolean / Array

2. Set Variable (Set Variable Activity)

  • Drag Set Variable activity into your pipeline.

  • In the settings:

    • Variable name: myVar

    • Value: Use dynamic content (e.g.,)


'Hello World' @concat('Folder/', pipeline().parameters.fileName)

3. Modify Variable (Append Variable Activity)

Used only for Array variables to add elements during the pipeline.


🔹 Using Variables and Parameters in Activities

Here are a few examples of dynamic usage:

📌 In Copy Activity Source/Sink path:

adf

@concat('input/', pipeline().parameters.fileName)

📌 In If Condition Activity:

adf

@equals(variables('myVar'), 'expectedValue')

📌 In Stored Procedure Activity:

Pass parameter to SP:

adf

@variables('sqlParam')

🔹 Common Use Case

Suppose you want to pass a file name as a parameter and use it dynamically in a copy activity:

1. Define a parameter: fileName

2. In source dataset parameter:

adf

@pipeline().parameters.fileName

3. Set a variable based on this:

adf

@concat('processed/', pipeline().parameters.fileName)

✅ Summary

  • Parameters: Set once, used for configuration and input.

  • Variables: Used to store intermediate values during pipeline execution.

  • You can use expressions like @concat, @pipeline(), @variables(), etc., in most ADF activity fields via Dynamic Content.


Lookup activity, and for each loop activity 

[Lookup File List]
        ↓
   [ForEach File]
        ↓
[Copy / Databricks Activity]

For example, if we have 4 files that we need to ingest, we can use a lookup activity to consume all the files at once and iterate using a for each loop activity 

Here we are giving the output from the look-up activity as input for each activity.





In order to set the variables in inside the for loop we are giving set for loop activity .


in that set the variable as output of the source URL 



Now we are parameterizing the hardcoded URL in the linked service.


and then by using the copy activity we are ingesting the data .

Metadata-driven Architecture 

there are 4 source URL we need to ingest using one pipeline using one trigger .


within the for each activity the copy activity was there . and attached the trigger to that pipeline.



Comments

Popular posts from this blog

Entity Relationship (ER) Diagram Model with DBMS Example

Reference :   Entity Relationship (ER) Diagram Model with DBMS Example What is ER Diagram? ER Diagram  stands for Entity Relationship Diagram, also known as ERD is a diagram that displays the relationship of entity sets stored in a database. In other words, ER diagrams help to explain the logical structure of databases. ER diagrams are created based on three basic concepts: entities, attributes and relationships. ER Diagrams contain different symbols that use rectangles to represent entities, ovals to define attributes and diamond shapes to represent relationships. At first look, an ER diagram looks very similar to the flowchart. However, ER Diagram includes many specialized symbols, and its meanings make this model unique. The purpose of ER Diagram is to represent the entity framework infrastructure. Entity Relationship Diagram Example Table of Content: What is ER Diagram? What is ER Model? History of ER models Why use ER Diagrams? Facts about ER Diagram Model ER Diagram...

SQL Joins and advanced joins and Subqueries

  Refernce :  Expert Guide to Advanced SQL Joins: What You Need to Know It's helpful to visualize how these different SQL joins work. Here's a breakdown in a table-like format, along with explanations: SQL Join Types Overview Join Type Description Key Characteristics Use Cases INNER JOIN Returns rows where there is a match in both tables. - Shows only matching records. - Excludes unmatched rows from both tables. - Retrieving related data that exists in both tables. - Finding records with corresponding entries in another table. LEFT OUTER JOIN (LEFT JOIN) Returns all rows from the left table, and the matched rows from the right table. - Includes all records from the left table. - Fills in NULL values for columns from the right table where there's no match. - Retrieving all records from one table and their related data from another, even if some records don't have matches. - Finding records in one table that don't have corresponding entries in another. RIGHT OUTER JO...

GIT BASH

  Bash Shell: Git Bash uses the Bash (Bourne Again SHell) command-line interpreter. This means you can use many of the same commands you'd find in a Linux or macOS terminal. Git Integration: Git Bash is tightly integrated with Git, making it easy to execute Git commands Essential Commands: Navigation: pwd : Prints the current working directory. ls : Lists files and directories in the current directory. cd <directory> : Changes the current directory. cd .. : Moves to the parent directory. File Management: mkdir <directory> : Creates a new directory. touch <file> : Creates a new file. rm <file> : Removes a file. rmdir <directory> : Removes an empty directory. Git Commands: git init : Initializes a new Git repository. git clone <repository URL> : Clones an existing Git repository. git status : Displays the status of your working directory. git add <file> : Adds a file to the staging area. git commit -m "commit message" : Commits chan...