如何从Azure数据湖分析文件(txt和CSV之类的文件)中获取记录计数 [英] How to fetch records count from Azure data lake analytics files (File like txt and CSV )
本文介绍了如何从Azure数据湖分析文件(txt和CSV之类的文件)中获取记录计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
adl://rs06ipadl01.azuredatalakestore.net/FIA/RDS/old/BANNER/2018/06/15/old_Banner.csv
adl://rs06ipadl01.azuredatalakestore.net/FIA/RDS/old/BANNER/2018/06/15/old_Banner.csv
我需要从上面的文件中获取记录.
i need to fetch the records from above file.
推荐答案
您可以使用诸如.Csv
和.Text
之类的内置提取器来获取文件内容,然后使用COUNT
来对记录进行计数.一个简单的例子:
You can the built-in extractors like .Csv
and .Text
to get the file content then use COUNT
to count the records. A simple example:
DECLARE @inputFile string = @"input/input124.csv";
DECLARE @outputFile string = @"output/output.csv";
// Get the file
@input =
EXTRACT col1 string,
col2 string,
col3 int
FROM @inputFile
USING Extractors.Csv( skipFirstNRows:1 ); // skip header row if you have one
// Count the records
@output = SELECT COUNT(*) AS records FROM @input;
// Output the result
OUTPUT @output
TO @outputFile
USING Outputters.Csv(quoting:false);
这篇关于如何从Azure数据湖分析文件(txt和CSV之类的文件)中获取记录计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文