I have thousands of dB files that need to be converted to CSV files. This can be achieved by a simple script / batch file i.e.
.open "Test.db"
.mode csv
.headers on.
I need the script to open the other db files which all have different names, is there a way that this can be performed as i do not want to write the above script for each db file
I prepared a short python script which will write a csv file from multiple sqlite databases.
will output the data to output.csv file.
Jupyter notebook and a python script are on github.
https://github.com/darshanz/CombineMultipleSqliteToCsv
The
sqlite3
command-line shell allows some settings to be done with command-line arguments, so you can simply execute a simpleSELECT *
for the table in each DB file:(When this is not part of a batch file but run directly from the command line, you must replace
%%
with%
.)I made a script that batch-converts all db-sqlite files in the current directory to CSV, called 'sqlite2csv'. Well it outputs each table of each db-sqlite as a CSV file, so if you have 10 files with 3 tables each you will get 30 CSV files. Hope it helps at least as a starting point to make your own script.