title: Read External SQL File into Pandas Dataframe
body: <p>This is a simple question that I haven't been able to find an answer to. I have a .SQL file with two commands. I'd like to have Pandas pull the result of those commands into a DataFrame. </p>
  
  <p>The SQL file's commands are as such, with the longer query using today's date.</p>
  
  <pre><code>SET @todaydate = DATE(NOW());
  SELECT ...long query....;
  </code></pre>
  
  <p>I've attempted to use read_sql in the following way after establishing my connection (prod_db) and get the error message ''NoneType' object is not iterable'</p>
  
  <pre><code>sqlpath = 'path.sql'
  scriptFile = open(sqlpath,'r')
  script = scriptFile.read()
  df = pd.read_sql(script,prod_db) 
  </code></pre>
  
  <p>I've also tried to use the function and approach described here <a href="https://stackoverflow.com/questions/19472922/reading-external-sql-script-in-python">reading external sql script in python</a> but I'm not sure how to get the result into a pandas dataframe (or perhaps I'm missing something). It doesn't seem to be reading the results as I get 'Command Skipped' repeatedly.</p>
  
  <pre><code>def executeScriptsFromFile(filename):
      fd = open(filename, 'r')
      sqlFile = fd.read()
      fd.close()
      # all SQL commands (split on ';')
      sqlCommands = sqlFile.split(';')
      # Execute every command from the input file
      for command in sqlCommands:
          try:
              c.execute(command)
          except OperationalError, msg:
              print "Command skipped: ", msg
  df = executescriptsfromfile(sqlpath)
  </code></pre>