I was reading up on the documentation and saw that you only have to commit in once in a transaction?
Does the following count as one transaction or does each function count as a transaction?
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()
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?
Thanks!