# Exercise 4: ETL pipeline, CSV Source & FTP Connector using Sections

In this exercise, store data in an Entity with a formatted date.

## Requirements

* For this exercise, use a CSV file with the following fields containing customer information.

{% hint style="info" %}
This is just test data, not real, and has been auto-generated by <http://www.convertcsv.com/generate-test-data.htm>. \
In this exercise, the joining date information is in the wrong format, and actions will be defined to correct it before storing it in the entity.&#x20;
{% endhint %}

* Store data through the ETL pipeline.&#x20;
* Use an FTP tool to establish a connection with the Langstack application. In this exercise, the tool in use is Filezilla.&#x20;
* File must be residing on the FTP server before the execution of the ETL pipeline starts.&#x20;
* Create entity “UserName\_Acc\_customers”.&#x20;
* Store the data from the CSV file in the entity “UserName\_Acc\_customers” after the following:&#x20;
  * Format the date to align with the format of the entity&#x20;
  * Create additional fields for
    * DayMonthJoinDate
    * Customer\_Value
    * Rating

## Solution

The CSV file stores customer information, which needs to be updated in the Customer entity. However, two issues need to be sorted beforehand:

1. The joining date for the customer in this file is in the format (M/DD/YYYY), whereas the format of the Join\_Date in the entity is (MM/DD/YYYY). The joining date values must be reformatted before storing in the entity.&#x20;
2. Three fields DateMonthJoinDate, Customer\_Value, and Rating are not present in the CSV file. These fields must be created in the ETL pipeline and assigned relevant values. \
   \
   The solution is based on the following steps:

* Step 1: Create the ETL pipeline adding the three extra fields for:
  * DateMonthJoinDate
  * Customer\_Value
  * Rating. \
    Map the Reader and Writer fields.&#x20;
* Step 2: When the ETL pipeline is created, define actions to convert the format of the Join\_Date received in the Reader to align with the format of the Join\_Date field in the target entity. Also, define Actions to assign values to Customer\_Value and Rating fields before storing in the entity.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-etl-pipeline/exercise-4-etl-pipeline-csv-source-and-ftp-connector-using-sections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
