Skip to content

Commit bcb4058

Browse files
committed
Update README.md
1 parent 9585ce2 commit bcb4058

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
csv2sql
2-
=======
1+
## SUMMARY
32

43
csv2sql - conversion program to convert a CSV file to SQL format to allow easy checking / validation, and subsequent import into a SQLite3 database using SQLite '.read' command
4+
5+
## ABOUT CSV2SQL
6+
7+
CVS2SQL is a small simple program specifically designed to quickly convert a coma separated value (CSV) file into structured query language (SQL) statements, that can then be used as an import source for an SQLite database.
8+
9+
The CSV file is also integrity checked while being converted to ensure it has a consistent number of column values throughout the file.
10+
11+
The first line of your CSV file will be designated as the header line - and therefore will become the column names in your subsequent SQLite database table.
12+
13+
Please note that any spaces or the following characters | - + @ # / \ : ( ) ' will be replaced in the column names with the underscore character (ie '_').
14+
15+
This is to avoid SQL syntax import issues, and make any future SQL statements referencing these column names easier to construct. You can of course rename these characters in your CSV file first. Or use the command line switch ' -k=true ' to force them to be left as is.
16+
17+
The rest of the CSV file will be split up on the comma character, on a per line basis. The eventual contents in your new database table will therefore be aligned to the column values - so each table row is a line from the CSV file.
18+
19+
The output filename (ie <sql-filename.sql>) will be created automatically for you when you run the program. Note that it will also overwrite / replace any existing file with the same name! The filename it will create will be based on your input filename, prefixed with 'SQL' and the file extension changed to '.sql'. So 'test-123.csv' -> 'SQL-test-123.sql'.
20+
21+
The newly generated output file will contain the SQL statements to allow the contents of your CSV file to be imported into a new SQLite database table. The table name to be used must be provide on the command line also as ' -t tablename ' - where tablename is the name of the SQLite table to hold your CSV file data.
22+
23+
To import the table and it contents, open your SQLite database with the sqlite3 program, and use: .read <sql-filename.sql>
24+
25+
## OTHER INFORMATION
26+
27+
- Latest version is kept on GitHub here: https://github.com/wiremoons
28+
- The program is written in Go - more information here: http://www.golang.org/
29+
- More information on SQLite can be found here: http://www.sqlite.org/
30+
- The program was written by Simon Rowe, licensed under "New BSD License

0 commit comments

Comments
 (0)