diff --git a/rattail_fabric/mysql.py b/rattail_fabric/mysql.py index d6d65bc..7183e0e 100644 --- a/rattail_fabric/mysql.py +++ b/rattail_fabric/mysql.py @@ -154,6 +154,13 @@ def sql(sql, database=''): return sudo("mysql --execute='{}' --batch --skip-column-names {}".format(sql, database)) +def script(path, database=''): + """ + Execute a SQL script against the given database. + """ + sudo('mysql {} < {}'.format(database, path)) + + def download_db(name, destination=None): """ Download a database from the "current" server.