Share My Creation Csv to SQLite program

Attached you find a small project to convert csv files to a SQLite database.
The program:
- detects automatically between the two separator characters ',' ';'.
- determines, on request, the data type for each column (TEXT, REAL, INREGER), these can be changed.
- the column names are the values of the first line in the csv file.
- three test csv files are included.

EDIT: 2021.09.18
Added the use of SQLite transaction, suggested by Diceman in post #6.

EDIT: 2021.01.29
Added an exe file:
CsvToSQLiteExe.zip
You need to unzip it to get the exe file.
Unfortunately the exe file is not accepted by my McAfee anti virus program it is put in quarantaine.
I must manually exclude from the analysis.

upload_2017-12-9_19-51-58.png
 

Attachments

  • CsvToSQLite.zip
    17.6 KB · Views: 903
  • CsvToSQLiteExe.zip
    7.3 KB · Views: 312
  • CsvToSQLiteV1_2.zip
    5.4 KB · Views: 183
  • CsvToSQLiteV1_2_Exe.zip
    7.3 KB · Views: 202
Last edited:

rboeck

Well-Known Member
Licensed User
Longtime User
Last week i found a wonderfull program, which is able to connect and migrate all most used databases against another; its include Access, Excel, dBase, Foxpro, Firebird, SQL Server, Sqlite, PostgreSql, ODBC, OLEDB and much more.
Its a matter minutes to transfer an access table to an sqlite db and back. Also text files are supported. Even the free version is very usefull.
Link: http://fishcodelib.com/DBMigration.htm
 

Diceman

Active Member
Licensed User
Klaus,

Very nice utility. :)

As a suggestion (no rush) you might want to wrap the table inserts in a transaction (with Try/Catch block) because it will run 20x faster. I did that with your program and it is now fast as lightning. If it throws an exception you should report the record# and the record contents on the screen so the user knows which CSV rcd caused the problem. In my case I roll back the transaction. I suppose you could also have an option (checkbox) to continue with the inserts even if there are exceptions.
 

klaus

Expert
Licensed User
Longtime User
Hi Diceman.
I saw your post only today, do not know why I missed it.

I added your suggestion to use SQLite transaction. Yes the program is now very fast.

The project has been updated to version 1.2 in the first post.
 

Mashiane

Expert
Licensed User
Longtime User
Last week i found a wonderfull program, which is able to connect and migrate all most used databases against another; its include Access, Excel, dBase, Foxpro, Firebird, SQL Server, Sqlite, PostgreSql, ODBC, OLEDB and much more.
Its a matter minutes to transfer an access table to an sqlite db and back. Also text files are supported. Even the free version is very usefull.
Link: http://fishcodelib.com/DBMigration.htm
Their tools have been my favorite like forever...
 
Top