# Dumpling Export Csv File

__*Dumpling Export CSV File*__

  + `./dumpling -u root -P 4000 -h 127.0.0.1 -o /tmp/test --filetype csv `


-------------------------------------------------------------
If the format of the exported data is CSV (you can export a CSV file using —filetype csv), you can also use —sql to <SQL>export the selected records with the specified SQL, for example:

```
./dumpling -u root -P 4000 -h 127.0.0.1 -o /tmp/test --filetype csv 
```

The —sql option can only be used to export a CSV scenario. The above command will execute a SELECT * FROM <table-name>WHERE id < 100 statement on all the tables to be exported. If some of the tables do not have the specified column, the export will fail.
When using —sql to configure the export, Dumpling cannot get the exported table database information. In this case, you can use the —output-filename-template option to specify the file name format of the CSV file to facilitate subsequent import of data files using TiDB Lightning. For example, —output-filename-template='test.sbtest1. {{.Index}} 'specifies that the exported CSV files are test.sbtest1.000000000, test.sbtest1.000000001, etc.

You can use the —csv-separator, —csv-delimiter options to configure the format of the CSV file. Specific information can be found (https://docs.pingcap.com/zh/tidb/stable/dumpling-overview#dumpling-%E4%B8%BB%E8%A6%81%E9%80%89%E9%A1%B9%E8%A1%A8)

notice
The dumpling export does not differentiate between strings and keyword. If the imported data is Boolean true and false, it will be converted to 1 and 0 on export.