Ajouter un job pour exécuter des requêtes
How to test:
- Start Synthese with a non-empty database to be able to run queries on it and see the results. To test with
MYSQL
andSQLite
databases. - Update website from disk for Connect
- Go to Connect and go to
Vue Interne
. - Add a query launcher by clicking the
+
sign next toTraitements de données
by choosing query_launcher in the drop-down list. - In
Propriétés
tab, clickOui
inLogs
onLogs des traitements dans la base de données
and click onEnregistrer
. - Go to the newly created job and in
Exécution
tab, you can run a SQL query inRequête SQL
field. You also have to provide a name inNom de la requête
and an e-mail address (or several) inAdresses e-mail
. You can test that if you forget one of these, the job will fail saying that one parameter is missing. - By default you can only run
SELECT
queries. To allow any query to be run, you have to start Synthese setting a parameter:--param all_queries_authorized=1
. You can test that queries other thanSELECT
will make the job fail ifall_queries_authorized
is not set and that it works when set. You can also test so run a bad SQL query, which should make the job fail with an SQL error. - To run the job, click on
Non
next toSimulation
and then onExécuter le traitement
. - After running the job, check that an issue is created for each record returned by the SQL query in the
Log
tab of that instance, by clicking onOuvrir
. - Check also that those issues have been created in the Synthese database under the table
t133_issues
. - Check also that an e-mail has been sent to each of the recipients. if you don't have a smtp server, you can start Synthese with those parameters:
--param smtp_server="127.0.0.1" --param smtp_port="10000"
. Then on the same machine you started the server, you can run the command:nc -lv 10000
. This will listen to any incoming data on port 10000 and you can display it by pressing Enter key when netcat notifies that some data has been received. - Check that the mail is correct and that the link in the body actually points to the run that generated this mail.
Edited by Kennan Gaham