I’m a firm believer in automating any task that I’m going to do more than once. Frequently I need to sync the databases on my local development environment to a remote production environment. Here’s a quick fabric fabfile I wrote to pull one or more databases from a remote server and use them to overwrite my corresponding local database(s).
Code
fabfile.py:
Closing remarks
Insert typical disclaimer: This is just example code for my specific setup. Potential issues to look for are the use of additional env.hosts values, and naming conflicts, among other things. Also, login previously setup via ssh key. Please read the code and make sure you understand it before getting your execute on.