title: Running a entire SQL script via python
body: <p>I'm looking to run the following <code>test.sql</code> located in a folder on my <code>C:</code> drive. I've been playing with cx_Oracle and just can't get it to work.</p>
  
  <p><code>test.sql</code> contains the following.</p>
  
  <pre><code>CREATE TABLE MURRAYLR.test
  ( customer_id number(10) NOT NULL,
    customer_name varchar2(50) NOT NULL,
    city varchar2(50)
  );
  
  CREATE TABLE MURRAYLR.test2
  ( customer_id number(10) NOT NULL,
    customer_name varchar2(50) NOT NULL,
    city varchar2(50)
  );
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>import sys 
  import cx_Oracle 
  connection = cx_Oracle.connect('user,'password,'test.ora') 
  cursor = connection.cursor() 
  f = open("C:\Users\desktop\Test_table.sql")
  full_sql = f.read() 
  sql_commands = full_sql.split(';') 
  for sql_command in sql_commands: 
    cursor.execute(sql_command)
    cursor.close() 
  connection.close()
  </code></pre>