I want to create a bash file where I connect to a docker container(mysql) and I run a query, and after I want to output the result in a csv file. What I've tried:
#!/bin/bash
docker-compose exec db /bin/bash -c 'mysql -u user -ppassword dbname
-e "SELECT c.id, c.first_name, c.last_name,
c.email, cp.id, cp.name, company.id, company.name FROM
db.candidate c LEFT JOIN db.candidate_position cp ON
cp.id = c.candidate_position_id LEFT JOIN db.company company
ON company.id = c.company_id INTO OUTFILE \'Result.csv\'"'
The error is that I get:
line 3: unexpected EOF while looking for matching `"'
No comments:
Post a Comment