I have data coming from an API in JSON format which I then run a few functions/transformations in python and then insert the data in to an SQL database through pandas & SQLalchemy.
Now, how do I automatically do this at the end of every day, without having to open up the script and run it manually?
-
Supposing this script runs on a server, what about using a crontab? i.e. put the script to run daily at 23:00hrs (0 23 * * *)AnhellO– AnhellO2020年06月29日 21:45:23 +00:00Commented Jun 29, 2020 at 21:45
1 Answer 1
You can use crontab on a server (or your Linux/Mac laptop but it will not run the script if its turned off of course).
You can run crontab -e to edit the crontab file. Add something like the following to run your script everyday at 11 PM:
0 23 * * * ~/myscript.py
crontab guru is a useful resource to try different schedule expressions.