chillinc / CQLEngine-Session

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CQLEngine-Session crashes when it encounters extra columns in the DB #3

Open mviamari opened 10 years ago

mviamari commented 10 years ago

Queries crash on a KeyError exception because it seems to be attempting to readback all columns from a select * query. This is a major issue because it means we cannot upgrade the DB model before we upgrade the code model.


Model Definition in Python

class TestModelObject(model):

     id = columns.Text(primary_key=True)
     value_a = columns.Text()

Model Definition in Cassandra Columnfamily id = columns.Text(primary_key=True) value_a = columns.Text() value_b = columns.Text() # this extra column causes the query error.


Traceback

1394559535.43 2014-03-11 10:38:55,360 30664 treasure ERROR - Internal Error
1394559535.43 Traceback (most recent call last):
1394559535.43   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
1394559535.43     rv = self.dispatch_request()
1394559535.43   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
1394559535.43     return self.view_functions[rule.endpoint](**req.view_args)
1394559535.43   File "/Users/mviamari/Workspace/code/treasure/code/app-server/src/treasure/views/api/helpers.py", line 42, in decorated
1394559535.44     return fn(*new_args, **new_kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/code/app-server/src/treasure/extensions/authentication/decorators.py", line 31, in decorated
1394559535.44     return fn(*args, **kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/flask_restful/__init__.py", line 397, in wrapper
1394559535.44     resp = resource(*args, **kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/flask/views.py", line 84, in view
1394559535.44     return self.dispatch_request(*args, **kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/flask_restful/__init__.py", line 487, in dispatch_request
1394559535.44     resp = meth(*args, **kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/code/app-server/src/treasure/extensions/authentication/decorators.py", line 55, in decorated
1394559535.44     return fn(*args, **kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/flask_restful/__init__.py", line 559, in wrapper
1394559535.44     resp = f(*args, **kwargs)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/code/app-server/src/treasure/views/api/post/inbox/resource.py", line 119, in get
1394559535.44     for _ii in inbox_qry.all():
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/cqlengine/query.py", line 275, in __iter__
1394559535.44     self._fill_result_cache_to_idx(idx)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/cqlengine/query.py", line 262, in _fill_result_cache_to_idx
1394559535.44     self._result_cache[self._result_idx] = self._construct_result(self._result_cache[self._result_idx])
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/cqlengine_session.py", line 480, in <lambda>
1394559535.44     return lambda values: self._session_class._construct_instance(names, values)
1394559535.44   File "/Users/mviamari/Workspace/code/treasure/built/code/app-server/virtualenv/lib/python2.7/site-packages/cqlengine_session.py", line 411, in _construct_instance
1394559535.44     col = cls.id_mapped_class._columns[name]
1394559535.44 KeyError: u'inactive'
Lifto commented 10 years ago

verified

Lifto commented 10 years ago

fixed