write data to text file in azure data factory version 2 - azure

It's seem ADF v2 does not support writing data to TEXT file (.TXT).
After select File System
But don't see TextFormat at the next screen
So do we any method to write data to TEXT file ?
Thanks,
Thai

Data Factory only support these 6 file formats:
Please see: Supported file formats and compression codecs in Azure Data Factory.
If we want to write data to a txt file, the only format we can using is Delimited text, when the pipeline finished, you will get a txt file.
Reference: Delimited text: Follow this article when you want to parse the delimited text files or write the data into delimited text format.
For example, I create a pipeline to copy data from Azure SQL to Blob, choose DelimitedText format as Sink dataset:
The txt file I get in Blob Storeage:
Hope this helps

I think what you are looking for is DelimitedText dataset. You can specify extension as part of the file name

Related

Split a file using Azure Data Factory based on delimiter

I'm very new to ADF, and I'm kinda stuck with the following use case:
I want to split a big file into multiple smaller files based on a delimiter. There will be a delimiter after some rows. For example, following is the input file content:
row1content
row2content
row3content
-----
row4content
row5content
-----
row6content
row7content
row8content
row9content
-----
row10content
row11content
row12content
Here ----- is the delimiter on which I want to split a file into multiple smaller files as output, and name them like MyFile1, MyFile2, MyFile3, MyFile4 and so on, such that their content will be as follows(split based on the delimiter):
MyFile1:
row1content
row2content
row3content
MyFile2
row4content
row5content
MyFile3:
row6content
row7content
row8content
row9content
MyFile4:
row10content
row11content
row12content
I'm trying to achieve it using Data flows in ADF.
The source and destination of input/output files will be azure blob storage.
It'll be really helpful if someone can point me to a direction or a source from where I can proceed further.

Data Factory Data Flow sink file name

I have a data flow that merges multiple pipe delimited files into one file and stores it in Azure Blob Container. I'm using a file pattern for the output file name concat('myFile' + toString(currentDate('PST')), '.txt').
How can I grab the file name that's generated after the dataflow is completed? I have other activities to log the file name into a database, but not able to figure out how to get the file name.
I tried #{activity('Data flow1').output.filePattern} but it didn't help.
Thank you
You can use GetMeta data activity to get the file name that is generated after the data flow.

Azure Data Factory- Data Flow - After completion - move

I am using ADF v2 DataFlow ativity to load data from a csv file in a Blob Storage into a table in Azure SQL database. In the Dataflow (Source - Blob storage), in Source options, there is an option 'After Completion(No Action/Delete Source file/ Move)'. I am looking to utilize the move option to save those csv files in a container renaming those files in concatenation with with today's date. How do I frame the logic for this? Can someone please help?
You can define the file name explicitly in both From and To-fields. This is not so well (if at all) documented, and I found it just trying different approaches.
You can also add dynamic content such as timestamps. Here's an example:
concat('incoming/archive/', toString(currentUTC(), 'yyyy-MM-dd_HH.mm.ss_'), 'target_file.csv')
You could parameter the source file to achieve that. Please ref my example.
Data Flow parameter settings:
Set the source file and move expression in Source Options:
Expressions to rename the source with "name + current date":
concat(substring($filename, 1, length($filename)-4),toString(currentUTC(),'yyyy-MM-dd') )
My full file name is "word.csv", the output file name is "word2020-01-26",
HTH.

Azure data factory - convert YYYYDDMMmmHHss to DDMMYYYYHHmmSS

how to convert YYYYDDMMmmHHss to DDMMYYYYmmHHSS in Azure data factory file name output
Regards
Ravi
I tried this and my source and sink are both csv.
This is my file name: 20201706170905.csv.
First:create a getMetaData activity like this
Then:create a copy activity,and the sink dataset filename set like this:
The expression in file name(you can use concat and substring to convert what you want):
#concat(substring(activity('Get Metadata1').output.itemName,4,4),substring(activity('Get Metadata1').output.itemName,0,4),substring(activity('Get Metadata1').output.itemName,10,2),substring(activity('Get Metadata1').output.itemName,8,2),substring(activity('Get Metadata1').output.itemName,12,6))
Finally: run the pipeline(if you don't need the Original file,you can use delete activity delete it).
Result:
Hope this can help you.

Azure Data Factory - CSV to Parquet - Changing file extension

I have created a Data Factory to convert a CSV file to Parquet format, as I needed to retain the orginial file name I am using the 'Preserve Hierarchy' at the pipeline. The conversion works fine but the output file is generated with the csv extension (an expected output). Is there any out of the box option I could use to generate the file name without the csv extension. I scanned through the system varaible currently supported by ADF and it doesn't list Input File name as an option to mask the file extension - https://learn.microsoft.com/en-us/azure/data-factory/control-flow-system-variables. Is writing a custom component the only option?
Thanks for your inputs.
You could use get metadata activity to get the file name of your source dataset and then pass it to both input and output dataset of your copy activity if you are using azure data factory v2.

Resources