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 MSSQL 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 ON MSSQL 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.
https://stackoverflow.com/questions/66467137/stored-procedure-using-pyodbc-not-loading-destination-table-in-sql-server March 04, 2021 at 09:06AM
没有评论:
发表评论