You can download the executables from the Releases page.
Run a local PostgresSQL instance:
docker-compose up
Open a new termial and run:
export DATABASE_URI="postgresql://localhost/postgres?user=postgres&password=mypassword&sslmode=disable"
go run main.go -q "select * from users" | tee output.csv
# or use the executable on MacOS for example
./sql2csv-amd64-darwin -q "select * from users" | tee output.csv
MySQL
export DATABASE_URI=mysql://root:mypassword@tcp(127.0.0.1:3306)/csv
Postgres
export DATABASE_URI="postgresql://localhost/postgres?user=postgres&password=mypassword&sslmode=disable"
MaxCompute (ODPS)
DATABASE_URI="http://ACCESS_KEY_ID:[email protected]/api?project=project_name"