mapping Date in AZure Data Factory

自作多情 提交于 2020-07-07 13:30:18

问题


Im working with Data actory this time this why i ask lot of question about that

My new problem is that my SOURCE(CSV file contains a column DeleveryDate full of Date dd/MM/YYYY) and my table SQl where i specify DElevry date as DateTime but when I map btw source and sink in Data preview source

duplicate columns like in the picture below but in data preview sink the columns always NULL the same in my table NULL.

Thanks


回答1:


You said column DeleveryDate full of Date dd/MM/YYYY), can you tell me why the column DeleveryDate has the values like '3', '1' in your screenshot? String '3' or '1' are not the date string with format dd/MM/YYYY.

If you want to do some data convert in Data Factory, I still suggest your to learn more about Data Flow.

For now, we can not convert date format from dd/MM/YYYY to datetime yyyy-MM-dd HH:mm:ss.SSS directly, we must do some other converts.

Look at bellow, I have a csv file contained a column with date format dd/MM/YYYY string, I still using DerivedColumn this time:

Add DerivedColumn:

Firstly, using this bellow expression to substring and convert dd/MM/YYYY to YYYY-MM-dd:

substring(Column_2, 7, 4)+'-'+substring(Column_2, 4, 2)+'-'+substring(Column_2, 1,2)

Then using toTimestamp() to convert it:

toTimestamp(substring(Column_2, 7, 4)+'-'+substring(Column_2, 4, 2)+'-'+substring(Column_2, 1,2), 'yyyy-MM-dd')

Sink settings and preview

My Sink table column tt data type is datetime:

Execute the pipeline:

Check the data in sink table:

Hope this helps.



来源:https://stackoverflow.com/questions/59970778/mapping-date-in-azure-data-factory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!