I am trying to simply delete records that are from the previous month in a sql table.
df_month_exist = pd.read_sql(''' DELETE FROM DATATABLE WHERE RECORD_MONTH = DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE())-1, -1) ''', con=sqlalchemy)
no errors when executed in SSMS, but i get this error in python:
sqlalchemy.exc.ResourceClosedError: This result object does not return rows. It has been closed automatically.
I am using sqlalchemy 2.025, pandas 2.1.4, pyodbc 5.0.1 and SSMS 19.2
I have tried using SET NOCOUNT ON in the sql statement , that did not help.