pudo / dataset

Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.
https://dataset.readthedocs.org/
MIT License
4.76k stars 297 forks source link

This result object does not return rows (dataset version 1.4.5) #371

Closed ehsen closed 3 years ago

ehsen commented 3 years ago

dataset generates error if you try to update a column with rawsql without returning any rows. The column actually updates but generates an exception.

This result object does not return rows. It has been closed automatically.

I think the above error relates to sqlchemy rather then dataset. You can reproduce the error on Windows 7 with a following simple function.

def fix_null_checkout(date, employee_code, check_out_time,check_in_time):

    statement = f"UPDATE Attendance SET check_out='{check_out_time}',check_in='{check_in_time}' WHERE date='{date}' AND employee_code='{employee_code}'"
    try:
        attendance_db.query(statement)
        return True
    except Exception as e:
        print(e)
        return False
pudo commented 3 years ago

I think this was fixed in 1.5.0, see https://github.com/pudo/dataset/commit/c13b79fc596cd570e243376cbd42bea63fbae4eb can you check?