def UploadTable(table):
conn = pyodbc.connect('Driver={SQL Server Native Client 11.0};Server=XXXXXX;Database=XXXXXX;Trusted_Connection=yes')
cur = conn.cursor()
cur.execute("TRUNCATE TABLE dr.Imported_OM01TMP4_Data")
create_statement = fts.fast_to_sql(table, "dr.Imported_OM01TMP4_Data", conn, if_exists="append")
cur.execute("EXEC [dr].[PopulateGlAccountRevenue_Files_UltimateEdition_DeltaLoad]")
conn.commit()
conn.close()
Please see my code snippet above, I am trying to run this stored procedure [dr].[PopulateGlAccountRevenue_Files_UltimateEdition_DeltaLoad] that is already defined in SQL Server.
My code runs fine but when I check to see if the destination table in the server is loaded with the data from the table dr.Imported_OM01TMP4_Data, I am seeing a blank.
When I populate the same table with my python code but execute the stored procedure in SQL Server, the destination table is loaded properly. Is this a permissions / access issue? I have DB Owner Access/Read/Write as well, so I am not sure what is wrong with my code.
Please advise.