facebookresearch / nle

The NetHack Learning Environment
Other
939 stars 113 forks source link

Incorrect syntax in db.delete_dataset #356

Open BartekCupial opened 1 year ago

BartekCupial commented 1 year ago

🐛 Bug

Incorrect syntax in db.delete_dataset.

To Reproduce

Steps to reproduce the behavior:

    db.create(dbfilename)
    populate_db.add_nledata_directory(dataset_path, dataset_name, dbfilename)

    with db.db(filename=dbfilename, rw=True) as conn:
        db.delete_dataset(dataset_name, conn)

Fix proposition

Changing lines 165-166 in https://github.com/facebookresearch/nle/blob/main/nle/dataset/db.py

        conn.execute("DELETE datasets WHERE dataset_name=?", (dataset_name,))
        conn.execute("DELETE roots WHERE dataset_name=?", (dataset_name,))

to

        conn.execute("DELETE FROM datasets WHERE dataset_name=?", (dataset_name,))
        conn.execute("DELETE FROM roots WHERE dataset_name=?", (dataset_name,))     

should fix the issue.