No description
Find a file
2019-09-28 19:37:17 +02:00
lib Include example, link to library README 2019-09-28 19:37:17 +02:00
.gitattributes Initial commit 2019-09-28 13:41:01 +02:00
.gitignore Update .gitignore 2019-09-28 18:40:56 +02:00
config.yml fix example config 2019-09-28 13:49:32 +02:00
index.js Change to only include base class when using npm 2019-09-28 19:30:41 +02:00
package.json Change to only include base class when using npm 2019-09-28 19:30:41 +02:00
README.md Include example, link to library README 2019-09-28 19:37:17 +02:00

SQL2CSV

Using sql2csv in code? see lib/README.md

Convert MySQL SELECT to CSV format

Config

Configuration is made through config.yml. Althrough the extension is yml, parser is implemented inside of the script and is only capable of reading string in format key: value. Both key and value are trimmed, passwords with space at end won't work.

Bellow is a table containing information about configuration. An example can be found in config.yml.

Key name Default value Description
host localhost Host to connect to
port 3306 Port to use
username root Username for connection
password Password for given user
showNames false Show table names in first row
crlf false Use crlf (windows) line endings

Folders

Input

'input' folder is for .sql files containing QUERYs. Query must be correct, isn't modified in any way (directly executed, as is). Must include SELECT. Make sure the input is save, it's directly executed and not checked for anything.

Output

'output' folder is for .cvs files. Output of sql2csv is written to the folder, the name of the file is same as input file except .sql is changed to .cvs.

The folders should be created before running the program. Sql2cvs doesn't create folders and will fail if they don't exist!