def apply_explain_plan_wrapper_if_needed(manager, sql): if 'explain_plan' in sql and sql['explain_plan']: explain_plan = sql['explain_plan'] ver = manager.version server_type = manager.server_type template_path = compile_template_name('sqleditor/sql', 'explain_plan.sql', server_type, ver) return render_template(template_path, sql=sql['sql'], **explain_plan) else: return sql['sql']
def apply_explain_plan_wrapper_if_needed(manager, sql): if 'explain_plan' in sql and sql['explain_plan']: explain_plan = sql['explain_plan'] ver = manager.version server_type = manager.server_type template_path = compile_template_name( 'sqleditor/sql', 'explain_plan.sql', server_type, ver ) return render_template(template_path, sql=sql['sql'], **explain_plan) else: return sql['sql']
def runTest(self): result = compile_template_name('some/prefix', 'some_file.sql', self.server_type, self.version) self.assertEqual(result, self.expected_return_value)