catalyst / moodle-tool_dataflows

A generic workflow and processing engine which can be configured to do a large variety of tasks.
GNU General Public License v3.0
13 stars 8 forks source link

Bug: dml_exception / Error reading from database error #537

Open marcghaly opened 2 years ago

marcghaly commented 2 years ago

When running following flow

trichoice_10082022_v1_2_courses_20220811_0412.yml.txt

On this version of mysql:

mysql Ver 14.14 Distrib 5.7.39, for Linux (x86_64) using  Editline wrapper

Following errors are triggered

2022 Aug 10, 10:48:22.540 Engine 'trichoice 10/08/2022 v1' Aborted: Error reading from database (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 21
SELECT concat(sd.dependson, '|', sd.stepid) as id,
sd.dependson AS src,
sd.stepid AS dest
FROM mdl_tool_dataflows_step_depends sd
LEFT JOIN mdl_tool_dataflows_steps step ON step.id = sd.stepid
WHERE step.dataflowid = ?
ORDER BY sd.position ASC
-- line 294 of /admin/tool/dataflows/classes/dataflow.php: call to mysqli_native_moodle_database->get_records_sql()
-- line 120 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->get_edges()
-- line 471 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->__get()
-- line 120 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->get_step_order()
-- line 450 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->__get()
-- line 120 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->get_steps()
-- line 147 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->__get()
-- line 120 of /admin/tool/dataflows/classes/dataflow.php: call to tool_dataflows\dataflow->get_variables()
-- line 520 of /admin/tool/dataflows/classes/local/execution/engine.php: call to tool_dataflows\dataflow->__get()
-- line 87 of /admin/tool/dataflows/classes/local/execution/flow_engine_step.php: call to tool_dataflows\local\execution\engine->get_variables()
-- line 245 of /admin/tool/dataflows/classes/step.php: call to tool_dataflows\local\execution\flow_engine_step->get_variables()
-- line 126 of /admin/tool/dataflows/classes/step.php: call to tool_dataflows\step->get_config()
-- line 159 of /admin/tool/dataflows/classes/local/step/flow_logic_case.php: call to tool_dataflows\step->__get()
-- line 140 of /admin/tool/dataflows/classes/local/step/flow_logic_case.php: call to class@anonymous/home/moodle/public/admin/tool/dataflows/classes/local/step/flow_logic_case.php:140$f7->__construct()
-- line 61 of /admin/tool/dataflows/classes/local/execution/flow_engine_step.php: call to tool_dataflows\local\step\flow_logic_case->get_iterator()
-- line 423 of /admin/tool/dataflows/classes/local/execution/engine.php: call to tool_dataflows\local\execution\flow_engine_step->go()
-- line 378 of /admin/tool/dataflows/classes/local/execution/engine.php: call to tool_dataflows\local\execution\engine->execute_step()
-- line 120 of /admin/tool/dataflows/run.php: call to tool_dataflows\local\execution\engine->execute()
[array (
0 => '2',
)])

or

2022 Aug 9, 20:18:29.144 Engine 'dataflow' dml_exception: ERROR: Mixed types of sql query parameters!! in /home/moodle/public/lib/dml/moodle_database.php:915
Stack trace:
#0 /home/moodle/public/lib/dml/mysqli_native_moodle_database.php(1268): moodle_database->fix_sql_params()
#1 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(294): mysqli_native_moodle_database->get_records_sql()
#2 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(120): tool_dataflows\dataflow->get_edges()
#3 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(471): tool_dataflows\dataflow->__get()
#4 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(120): tool_dataflows\dataflow->get_step_order()
#5 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(450): tool_dataflows\dataflow->__get()
#6 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(120): tool_dataflows\dataflow->get_steps()
#7 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(147): tool_dataflows\dataflow->__get()
#8 /home/moodle/public/admin/tool/dataflows/classes/dataflow.php(120): tool_dataflows\dataflow->get_variables()
#9 /home/moodle/public/admin/tool/dataflows/classes/local/execution/engine.php(520): tool_dataflows\dataflow->__get()
#10 /home/moodle/public/admin/tool/dataflows/classes/local/execution/flow_engine_step.php(87): tool_dataflows\local\execution\engine->get_variables()
#11 /home/moodle/public/admin/tool/dataflows/classes/step.php(245): tool_dataflows\local\execution\flow_engine_step->get_variables()
#12 /home/moodle/public/admin/tool/dataflows/classes/step.php(126): tool_dataflows\step->get_config()
#13 /home/moodle/public/admin/tool/dataflows/classes/local/step/flow_logic_case.php(159): tool_dataflows\step->__get()
#14 /home/moodle/public/admin/tool/dataflows/classes/local/step/flow_logic_case.php(140): class@anonymous->__construct()
#15 /home/moodle/public/admin/tool/dataflows/classes/local/execution/flow_engine_step.php(61): tool_dataflows\local\step\flow_logic_case->get_iterator()
#16 /home/moodle/public/admin/tool/dataflows/classes/local/execution/engine.php(423): tool_dataflows\local\execution\flow_engine_step->go()
#17 /home/moodle/public/admin/tool/dataflows/classes/local/execution/engine.php(378): tool_dataflows\local\execution\engine->execute_step()
#18 /home/moodle/public/admin/tool/dataflows/run.php(120): tool_dataflows\local\execution\engine->execute()
#19 {main}

I suspect this is a crosscompatibility issue, as this flow is running without issue on pgsql, this seems to be triggered here https://github.com/catalyst/moodle-tool_dataflows/blob/MOODLE_35_STABLE/classes/dataflow.php#L285

marcghaly commented 2 years ago

trichoice_10082022_v1_2_courses_20220811_0412.yml.txt

brendanheywood commented 2 years ago

Just noting this is almost certainly an infrastructure issue not a bug in this plugins so will likely be closed as a noop when we get to the bottom of it