Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16773

"This result object does not return rows" error with pandas .read_sql()

$
0
0

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.


Viewing all articles
Browse latest Browse all 16773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>