Python using Pyodbc connecting to Sql 2012 calling up a stored procedure
<p>I have a stored procedure that works 100% when run from the Sql server.  It updates at least 5 different tables.  When I run it from Python it only updates the first two tables.  Does not complete on the remaining tables.  The parameters passed are exactly the same as run from the sql server directly.  The data is reset to a common starting point with each test.  Has anyone come across this issue with Python execution of stored procs?  I am using Python 3.5 and Pyodbc from less than a month ago, Sql 2012 client and server on windows.  It is not a commit issue because the first two tables are updating/commiting.  The sql statement it fails on is not at all complex.  I am guessing some sort of limitation like time or only update so many tables with a given sql call?  My next step is to do each of the steps from Python as separate steps not from a single do everything Stored Proc to see if I get any differences but I am hoping to not have to do that.</p>

<pre><code>str_rs_SqlCommand = "{call dbo.usp_LaborLogBatchPerson ('Test User', '1')}"  ### Passes parameters to the stored procedure 
print (str_rs_SqlCommand)
obj_dbc_Connection2 = pyodbc.connect("DRIVER={SQL Server} " + " ;SERVER=" + str_dbc_ServerName + " ;DATABASE=" + str_dbc_Name + " ;UID=" + str_dbc_Uid + " ;PWD=" + str_dbc_Pwd + "" + "" ) #;autocommit=True #tried with and without autocommit
conn = obj_dbc_Connection2.cursor()    ### Create a cursor for the sql connection 
conn.execute(str_rs_SqlCommand) 
conn.commit()
obj_dbc_Connection2.close 
</code></pre>

<p>I found it by stepping through piece by piece of what it was doing.  Having a "Print Statement" in the stored procedure ends the execution of the stored procedure at that step.  Make sure you don't use print statements in stored procedures if you are using Python 3.5 with Pyodbc with MSSql 2012 on a Winderz platform......</p>

python sql-server-2012 pyodbc