Question

I have a problem, that i want to export data automatically every week to a csv is it possible?

I have my code in a stored procedure and i have an event that's fires every week.

My stored procedure

DELIMITER $$

CREATE DEFINER=`lower`@`%` PROCEDURE `backup1`()
BEGIN

My query



INTO OUTFILE '/tmp/nytest2.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n';

END

My event

CREATE EVENT backup_fil3
ON SCHEDULE
AT CURRENT_TIMESTAMP + INTERVAL 7 Day
DO CALL backup1;

And my second question is how can i access the csv file or can i save it directly to, for example dropbox?

Was it helpful?

Solution

You can use crontab or MySQL event scheduler for the running every week part. For the CSV part, you can see the answers for this question. If you want to save it to dropbox, I guess you would need to use its API (I've not used, so don't know anything about it) and write code in one of the languages they support for the API.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top