dherbst / mysql2csv

Convert the mysql text result format to csv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Report Card

mysql2csv

This project helps convert the mysql text result format to csv. This is necessary if you need to run queries on mysql on Amazon RDS, which does not allow the SELECT ... INTO ... OUTFILE syntax because there isn't access to (disc) storage on the server. Instead you can either copy and paste, or use the tee command to save the query output to your local machine and run this command to convert the mysql text output format to csv.

Usage

cat queryresult.txt | mysql2csv > result.csv

Design

The grammar for a mysql result looks roughly like this

LINE       ::= <LEFT-PIPE><TEXT><RIGHT-PIPE>
TEXT       ::= <TEXT><MID-PIPE><TEXT>|<CHARS>
CHARS      ::= [utf-8 character set]
LEFT-PIPE  ::= "| "
RIGHT-PIPE ::= " |"
MID-PIPE   ::= " | "

About

Convert the mysql text result format to csv

License:MIT License


Languages

Language:Makefile 60.9%Language:Go 39.1%