[PYTHON] Export Amazon RDS tables in CSV format

problem

Amazon RDS cannot use SELECT ... INTO OUTFILE.

The "SELECT ... INTO OUTFILE" command creates a file on the database server.  MySQL does not provide a way to use this command to create a file on the client. 

https://forums.aws.amazon.com/thread.jspa?threadID=41443

Solution

By using mysqldump_to_csv.py, I was able to output in CSV.

Command installation

$ wget https://raw.githubusercontent.com/jamesmishra/mysqldump-to-csv/master/mysqldump_to_csv.py

CSV output

$ mysqldump -u username -p --host=rdshostname database table | python mysqldump_to_csv.py > table.csv

Reprint source

Exporting table from Amazon RDS into a csv file

Recommended Posts

Export Amazon RDS tables in CSV format
[Django] Import and export DB tables in Excel or CSV format
Export DB data in json format
Csv in python
format in python
Read the linked list in csv format with graph-tool
Save TOPIX time series in pickle, csv, Excel format