Handle SQL statements without rows returned
yolile opened this issue · 1 comments
Currently, if you run a SQL query that doesn't return rows (set, inserts, updates, etc), you got an exception, as reported here, because this line expects to get a result set
Line 373 in ee7e209
Ideally, it should handle statements without rows returned, or add a special case for queries starting with the word "set", as mentioned here.
Hi, I got the same issue.
The problem is really critical because not even a use mydb
works.
The error message is
ResourceClosedError: This result object does not return rows. It has been closed automatically.
The problem was introduced by sqlalchemy 1.4.
A workaround is:
!pip install "sqlalchemy<1.4"
But it would be great if you could make ipython-sql compatible to sqlalchemy 1.4 again.
Steps to reproduce:
%load_ext sql
%sql create table dummy(x int)
I created a reproducable example including the workaround on colab:
https://colab.research.google.com/gist/jsalbr/d4d280f1a68521071bf623427e9a1abd/ipython-sql_issue191.ipynb