简体   繁体   中英

Extracting metadata in Azure Data factory

I have a csv file

Customer,Gender,Age,City
1,Male,23,Chennai
4,Female,34,Madurai
3,Male,23,Bangalore

My Azure SQL DB's table TAB_A has only one column: Column_Name I need to move the header of csv file into TAB_A such that the result is:

Column_Name
Customer
Gender
Age
City

Is it possible to achieve this functionality with ADF - Mapping Data flow without using Databricks/Python.

I tried with Source - Surrogate Key - Filter. Able to extract header as row. Unable to transpose. Any pointers? Thanks.

I created a simple test and successfully inserted the header into the sql table. 在此处输入图像描述

  1. I created a test.csv file, set it as source data, unselect First row as header .
    在此处输入图像描述 Source data preview is as follows:
    在此处输入图像描述

  2. Use SurrogateKey1 activity to generate a Row_No column. 在此处输入图像描述 SurrogateKey1 activity data preview is as follows:
    在此处输入图像描述

  3. Use FIlter1 activity to filter header via expression Row_No == 1 . 在此处输入图像描述 Data preview is as follows:
    在此处输入图像描述

  4. UseUnpivot1 activity to perform row-column conversion.
    Ungroup by Row_No . 在此处输入图像描述
    Unpivot key: just fill in a column name.
    在此处输入图像描述 Unpivoted columns: This column name must be consistent with the column name in your sql table. This way ADF will do automatic mapping. 在此处输入图像描述
    Data preview is as follows:
    在此处输入图像描述

That's all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM