Greetings,
I am creating a mysql database with the salt mysq_database.present, creating a user with mysql_user.present, and now need to seed the initial schema.
I have data in a text file provided by the application, and would normally run mysql -h servername -u root -psomepass < provided_file.sql
query_id:
mysql_query.run
- database: my_database
- query: "SELECT * FROM table;"
- output: "/tmp/query_id.txt"
Since query seems to be the only interface allowing me to interact with mysql, I thought I might be able to import my sql file, and pass that into the query like:
{%- import_text "provided-schema.sql" as schema %}
import_sql_schema:
mysql_query.run:
- database: 'some_db'
- query: {{ schema }}
But this seems to throw lots of errors based on the contents of the sql file.
Data failed to compile:
----------
Rendering SLS 'base:ztest.schema' failed: Illegal tab character; line 7
I figure I can't be the first person to want to import data into mysql with salt, so what is everyone else doing?
Thanks much!