From ba8453c923357237ba1f4fe598899f39e9c06f5a Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sun, 3 Jan 2016 19:47:53 +0100 Subject: [PATCH] Print optimization steps Prints the various steps on stdout, quite nice to be able to understand what is happening internally. --- relational_gui/guihandler.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/relational_gui/guihandler.py b/relational_gui/guihandler.py index 393d0eb..27b84ae 100644 --- a/relational_gui/guihandler.py +++ b/relational_gui/guihandler.py @@ -153,10 +153,17 @@ class relForm(QtWidgets.QMainWindow): res_rel,query = self.user_interface.split_query(self.ui.txtQuery.text(),None) try: + trace = [] result = optimizer.optimize_all( query, - self.user_interface.relations + self.user_interface.relations, + debug=trace ) + print('==== Optimization steps ====') + print(query) + print('\n'.join(trace)) + print('========') + if res_rel: result = '%s = %s' % (res_rel, result) self.ui.txtQuery.setText(result)