- changed status to closed
update error using vertica-python
Issue #3695
closed
Hi. I use your library (1.0.12) with vertica_python adapter(0.5.5) and get that situation:
2016-04-22 16:26:24,691 INFO sqlalchemy.engine.base.Engine UPDATE orders SET comment=:comment, ts_last_activity=:ts_last_activity, state=:state, previous_state=:previous_state, flags=:flags WHERE orders.id = :orders_id
2016-04-22 16:26:24,691 INFO sqlalchemy.engine.base.Engine {'comment': '"last_activity"=>"2016-04-22 13:26"', 'orders_id': 2000205, 'previous_state': 500, 'state': 300, 'flags': 2048, 'ts_last_activity': 1461320780}
2016-04-22 16:26:24,790 INFO sqlalchemy.engine.base.Engine ROLLBACK
StaleDataError: UPDATE statement on table 'orders' expected to update 1 row(s); -1 were matched.
Here I'm checking the session state:
>>> SessionVertica.identity_map
<sqlalchemy.orm.identity.WeakInstanceDict object at 0x7f43c5e46f90>
>>> SessionVertica.identity_map.check_modified()
True
>>> SessionVertica.identity_map.keys()
[(<class 'hasoffers.core.model.order.S'>, (2000205,))]
>>> recounted_base.id
2000205
As you see, I have rows for update, but i get the error above. Do you have any idea, what does it means?
Comments (1)
-
repo owner - Log in to comment
this is an issue in the vertica_python SQLAlchemy adapter you're using (I don't know which one you are using). The database driver is not reporting a valid number for "rows updated" and the adapter must configure its "supports_sane_rowcount" flag to not expect this feature to work. you'd need to report it against that adapter's project.