FAOCropsLivestock.csv contains more than 14 million row. In my .fs file I have declared
type FAO = CsvProvider<"c:\FAOCropsLivestock.csv">
and tried to work with follwoing code
FAO.GetSample().Rows.Where(fun x -> x.Country = country) |> ....
FAO.GetSample().Filter(fun x -> x.Country = country) |> ....
In both cases, exception was thrown.
I also have tried with follwoing code after loading the csv file in MSSQL Server
type Schema = SqlDataConnection<conStr>
let db = Schema.GetDataContext()
db.FAOCropsLivestock.Where(fun x-> x.Country = country) |> ....
it works. It also works if I issue query using OleDb connection, but it is slow.
How can I get a squence out of it using CsvProvider?
.csvdocument with, for example, the first 100 lines of that big file? This should give the CSV provider something to work with without overwhelming it. I don't know if it'll work, but it might be able to parse the real file afterwards... Worth a try, I'd say.... - Mark SeemannCsvProviderhasSkipandTakefunctions to do so ... But it probably will take more time than that ofOleDb. - user6283344StreamReaderandStreamWriterin C# earlier for flat files. - user6283344