ipython-sql
ipython-sql copied to clipboard
Handle SQL statements without rows returned
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 https://github.com/catherinedevlin/ipython-sql/blob/ee7e209744ed2316cce5912ffdde1d47b530f38f/src/sql/run.py#L373
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