New in version 2014.7.0.
MySQLdb Python module
See salt.modules.mysql
for setup instructions.
The mysql_query module is used to execute queries on MySQL databases. Its output may be stored in a file or in a grain.
query_id:
mysql_query.run
- database: my_database
- query: "SELECT * FROM table;"
- output: "/tmp/query_id.txt"
Execute an arbitrary query on the specified database
Used only as an ID
The name of the database to execute the query on
The query to execute
grain: output in a grain other: the file to store results None: output to the result comment (default)
grain to store the output (need output=grain)
the specified grain will be treated as a dictionary, the result of this state will be stored under the specified key.
The file or grain will be overwritten if it already exists (default)
The state run will check that the specified database exists (default=True) before running any queries
A list of client flags to pass to the MySQL connection. https://dev.mysql.com/doc/internals/en/capability-flags.html
Execute an arbitrary query on the specified database
New in version 2017.7.0.
Used only as an ID
The name of the database to execute the query_file on
The file of mysql commands to run
grain: output in a grain other: the file to store results None: output to the result comment (default)
grain to store the output (need output=grain)
the specified grain will be treated as a dictionary, the result of this state will be stored under the specified key.
The file or grain will be overwritten if it already exists (default)
The saltenv to pull the query_file from
The state run will check that the specified database exists (default=True) before running any queries
A list of client flags to pass to the MySQL connection. https://dev.mysql.com/doc/internals/en/capability-flags.html