def execute_queries(self): import re # Editor instance editor = self.tab.currentWidget() # Text text = editor.toPlainText() # Ignore comments table = Pireal.get_service("container").table_widget for line in text.splitlines(): if line.startswith('--'): continue parts = line.split('=', 1) parts[0] = parts[0].strip() if re.match(r'^[_a-zA-Z]+[_a-zA-Z0-9]*$', parts[0]): relation_name, line = parts else: relation_name = 'rel_{}'.format(self.__nrelation) self.__nrelation += 1 try: expression = parser.convert_to_python(line.strip()) rel = eval(expression, table.relations) except Exception as reason: #try: #except Exception as reason: QMessageBox.critical(self, self.tr("Error en consulta"), reason.__str__()) return table.add_new_table(rel, relation_name) table.relations[relation_name] = rel
def execute_queries(self): # Editor instance query_editor = Pireal.get_service("query-editor").editor query = query_editor.toPlainText() # Text # Parse query expression = parser.convert_to_python(query) table_widget = Pireal.get_service("db") rel = eval(expression, table_widget.relations)