Head's Up! Site migration is underway. Phase 2: migrate recent content
β08-17-2021 01:56 PM
I'm looking at a project where there are multiple text files (each being a report that needs to be parsed). There is a standard naming convention for the files (xxx-report#.txt). Is there an easy way to read through the list of files and then one-by-one do an import of the data?
β08-19-2021 01:31 PM
depends what your parsing entails.
you can do
UNWIND range(1,100) as id
LOAD CSV FROM "file://xxx-report"+id+".txt") as row FIELTERMINATOR '\n'
....
if you configure newlines as field terminators each of your rows is a single element array.
β08-19-2021 01:42 PM
I like the solution, but the ID numbers are not sequential. They are case numbers in the file name. I do like the possible idea of having a file with the list of filenames in it, then reading it to start iterating through the individual file contents.
I may end up researching some basic Python script to wrap around it as another way to look at the task.
β08-19-2021 02:01 PM
Yep, if you have a file or api or something with the case numbers you can load them them from there and then iterate over that list.
All the sessions of the conference are now available online