xiaojunxu / SQLNet

Neural Network for generating structured queries from natural language.
BSD 3-Clause "New" or "Revised" License
432 stars 162 forks source link

dataset error: sqlite3.ProgrammingError, sqlalchemy.exc.ProgrammingError: #44

Closed Baidi96 closed 5 years ago

Baidi96 commented 5 years ago

Hi, when I run 'python test.py --ca' to get execution results, it fails at 'print("Dev execution acc: {}".format(epoch_exec_acc(model, BATCH_SIZE, val_sql_data, val_table_data, DEV_DB)))'. The error is like this: rror closing cursor Traceback (most recent call last): File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1268, in fetchone row = self._fetchone_impl() File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1148, in _fetchone_impl return self.cursor.fetchone() sqlite3.ProgrammingError: Cannot operate on a closed database.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1325, in _safe_close_cursor cursor.close() sqlite3.ProgrammingError: Cannot operate on a closed database. Traceback (most recent call last): File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1268, in fetchone row = self._fetchone_impl() File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1148, in _fetchone_impl return self.cursor.fetchone() sqlite3.ProgrammingError: Cannot operate on a closed database.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "test.py", line 83, in model, BATCH_SIZE, test_sql_data, test_table_data, TEST_DB))) File "/data/home/naturallanguage/text2sql/sqlnet/utils.py", line 178, in epoch_exec_acc ret_gt = engine.execute(tid, sql_gt['sel'], sql_gt['agg'], sql_gt['conds']) File "/data/home/naturallanguage/text2sql/sqlnet/lib/dbengine.py", line 25, in execute table_info = self.db.query('SELECT sql from sqlite_master WHERE tbl_name = :name', name=table_id).all()[0].sql.replace('\n','') File "/data/anaconda/envs/py35/lib/python3.5/site-packages/records.py", line 195, in all rows = list(self) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/records.py", line 126, in iter yield next(self) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/records.py", line 136, in next nextrow = next(self._rows) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/records.py", line 365, in row_gen = (Record(cursor.keys(), row) for row in cursor) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 946, in iter row = self.fetchone() File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1276, in fetchone e, None, None, self.cursor, self.context File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1458, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 276, in reraise raise value.with_traceback(tb) File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1268, in fetchone row = self._fetchone_impl() File "/data/anaconda/envs/py35/lib/python3.5/site-packages/sqlalchemy/engine/result.py", line 1148, in _fetchone_impl return self.cursor.fetchone() sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) Cannot operate on a closed database. (Background on this error at: http://sqlalche.me/e/f405)

Any hint on how to solve this? Many thanks!

Baidi96 commented 5 years ago

fixed. got to downgrade records to 0.5.2