nprapps / arrested-development

The one about Arrested Development.
Other
8 stars 1 forks source link

Can't bootstrap data #245

Closed onyxfish closed 11 years ago

onyxfish commented 11 years ago

Traceback (most recent call last): File "/Users/onyxfish/.virtualenvs/arrested-development/lib/python2.7/site-packages/fabric/main.py", line 717, in main _args, _kwargs File "/Users/onyxfish/.virtualenvs/arrested-development/lib/python2.7/site-packages/fabric/tasks.py", line 332, in execute results[''] = task.run(_args, _new_kwargs) File "/Users/onyxfish/.virtualenvs/arrested-development/lib/python2.7/site-packages/fabric/tasks.py", line 112, in run return self.wrapped(_args, *_kwargs) File "/Users/onyxfish/src/arrested-development/fabfile.py", line 479, in bootstrap_data update_details() File "/Users/onyxfish/src/arrested-development/fabfile.py", line 542, in update_details parse_sheet('3', 'episodejokes') File "/Users/onyxfish/src/arrested-development/fabfile.py", line 558, in parse_sheet app_utils.parse_sheet(sheet, model) File "/Users/onyxfish/src/arrested-development/app_utils.py", line 196, in parse_sheet _parse_episodejoke_details(csv.DictReader(csv_file), sheet) File "/Users/onyxfish/src/arrested-development/app_utils.py", line 288, in _parse_episodejoke_details for episode in Episode.select(): File "/Users/onyxfish/.virtualenvs/arrested-development/lib/python2.7/site-packages/peewee.py", line 1563, in iter return iter(self.execute()) File "/Users/onyxfish/.virtualenvs/arrested-development/lib/python2.7/site-packages/peewee.py", line 1556, in execute self._qr = ResultWrapper(self.model_class, self._execute(), query_meta) File "/Users/onyxfish/.virtualenvs/arrested-development/lib/python2.7/site-packages/peewee.py", line 1090, in init for i in range(len(self.cursor.description)): TypeError: object of type 'NoneType' has no len()

onyxfish commented 11 years ago

When using some versions of sqlite w/ peewee, its possible for the database cursor to be corrupted if iterating over a response set while simultaneously updating related tables. The solution is to cache result sets into memory. This just happens to also be a major performance win.

onyxfish commented 11 years ago

References:

https://groups.google.com/forum/#!msg/peewee-orm/_fUt7hSSEpw/eOu0SC8s4mcJ https://github.com/coleifer/peewee/issues/81