-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help: looping through a table of CSV files #18
Comments
SQLite does not include a scripting language like Oracle or PostgreSQL. I believe you have to use Python or like to automate the task. |
Hi, I am running my sqlite "script" using sqlite3.exe and it's "-init" option and no db name. This loads the script file with dot commands and SQL, runs and then leaves the REPL open for interaction. It is also gives great error messages to help me learn. See Command Line Shell https://sqlite.org/cli.html I am simply looking for a way to use SQLite to repeat a process using vsv on a list (table) of filenames. I know SQLite does not have stored procedures, but I was hoping there is a native SQL/SQLite syntax to repeat the same analysis using parameters from a table? The WITH RECURSIVE statement seems to be a likely candidate, but making it do what I want is beyond my ability. I known this may be stretching the Appropriate Uses, but it's so tempting to try maximising what can be done with just SQLite3.exe with your add-on libraries😊 Kind Regards |
Sorry clicked close by mistake! |
Not that I know of. |
Many thanks for your time. I will report back if I can find a solution. Kind Regards Gavin Holt |
Sorry I couldn't help 🤷 |
There is the csv extension, which allows for the following syntax:
|
Hi,
I am using SQLean in a script to process UK NHS waiting times (I'm a surgeon - not an IT professional). This uses 50 large (90+MB) CSV files and I have been using vsv.dll to load each file, extract data, then drop the file, finally dumping the extract.
The main attraction is using SQLite3.exe to run scripts or as a REPL. This neatly avoids using any other programming language i.e. a single script to maintain/share. (I would be reluctant to resort to batch files or another programming language if I can possibly achieve my goals with just SQLite3.exe).
The whole process of reading the CSV and dumping into Excel is brilliant. I guess much work has gone into the CSV reading library - many thanks.
With cut/paste I have made it work, but there is a great deal of repetition making further development difficult.
Googling I suspect there is a way to loop through a table of file names? This would seem to be a likely usage pattern for vsv.dll and I was hoping you might show me an example to follow?
I don't expect you to write the script for me but I have appended below my work so far.
Any guidance welcome.
Kind Regards Gavin Holt
Raw data from:
https://www.england.nhs.uk/statistics/statistical-work-areas/rtt-waiting-times/
I hand edited these to remove top lines and create consistent filenames
Load vsv
My table of files:
Create a table to hold summary
My analysis for each file:
Export to excel:
End:
The text was updated successfully, but these errors were encountered: