class_docstr: Test Class for OpenAI Integration Testing
class_docstr_tok: ["Test","Class","for","OpenAI","Integration","Testing"]
docstr: Execute SQL and return a DataFrame, raising an AssertionError if an error occurs
docstr_tok: ["Execute","SQL","and","return","a","DataFrame",",","raising","an","AssertionError","if","an","error","occurs"]
code: def run_sql(self, sql):
      """Execute SQL and return a DataFrame, raising an AssertionError if an error occurs"""
      ret = self.command_executor.execute_command(
          parse_sql(sql, dialect="mindsdb")
      )
      assert (
          ret.error_code is None
      ), f"SQL execution failed with error: {ret.error_code}"
      if ret.data is not None:
          columns = [
              col.alias if col.alias else col.name
              for col in ret.columns
          ]
          return pd.DataFrame(ret.data, columns=columns)
  
imports: import os
  import time
  import pytest
  import pandas
  from unittest.mock import patch
  from mindsdb_sql import parse_sql
  from mindsdb.integrations.handlers.openai_handler.openai_handler import OpenAIHandler
  from ..executor_test_base import BaseExecutorTest
label_desc: Use image node_id 4 for calling the TestOpenAI obj's underlying member method code with example usage: obj.run_sql(sql) and returns: pd