title: connection commit function Python
body: <p>I was reading up on the documentation and saw that you only have to commit in once in a transaction?</p>
  
  <p>Does the following count as one transaction or does each function count as a transaction?</p>
  
  <pre><code>def main():
      conn=pyodbc.connect(sqlconnectionstring) # Assume this connects to the database
      cursor = conn.cursor()
  
      function1()
      function2()
  
      conn.commit()
  
  def function1():
      # does inserting here
  
  def function2():
      # does inserting here and calls function 3
      function3()
  
  def function 3():
      # does more inserting here
  main()
  </code></pre>
  
  <p>Is that conn.commit() enough to commit all insertions in all the functions or would I have to pass the "conn" variable as an argument and commit inside each function?</p>
  
  <p>Thanks!</p>