Add mysql.script() convenience function

This commit is contained in:
Lance Edgar 2018-07-15 17:47:03 -05:00
parent de2318fd43
commit 31acf33465

View file

@ -154,6 +154,13 @@ def sql(sql, database=''):
return sudo("mysql --execute='{}' --batch --skip-column-names {}".format(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): def download_db(name, destination=None):
""" """
Download a database from the "current" server. Download a database from the "current" server.