mcfunley / pugsql

A HugSQL-inspired database library for Python
https://pugsql.org
Apache License 2.0
673 stars 22 forks source link

improve errors when misapplying `:one`, `:many`, etc to queries that don't return anything #22

Open mcfunley opened 4 years ago

mcfunley commented 4 years ago

We can probably give a pugsql-specific error when this happens. Currently you get something like:

sqlalchemy.exc.ResourceClosedError: This result object does not return rows. It has been closed automatically.

(Might be driver-specific, not sure)

nihiliad commented 4 years ago

Definitely driver-specific. I got this error because I used the :insert return type with cx_Oracle, which doesn't return anything for inserts. Some documentation about all this would be nice, too. I would be happy to work on it, but I might need a little guidance.

Thanks for a great package, BTW!