Closed jeffnappi closed 7 years ago
Thanks for reporting, we'll take a look at this.
The rewrite_update
method is there to narrow the update statement. If you only updated a single property on an object, it will only update that instead of the whole object: instead of update t set x = ?
it will execute update t set x['y']['z'] = ?
if possible.
(This has the advantage that we can resolve conflicts on the server side. For example if one client issued set x['a'] = 10
and another set x['b'] = 20
a conflict can be resolved because we know that different properties are updated. If it was issued like set x = {"a": 10, "b": 10}
and set x = {"a": 5, "b": 20}
, the second update would overwrite the a
value.
Hi @jeffnappi. I took a look at the problem and opened a PR https://github.com/crate/crate-python/pull/224. Your code should run afterwards. If not, maybe you could provide your Post
model?
@mxm Looks like it works :)
Merged the PR. Should be fixed. If not, feel free to re-open!
In the process of updating our codebase from
SQLAlchemy==0.9.2
+crate==0.16.1
toSQLAlchemy==1.1.9
+crate==0.19.2
, I immediately encountered this error in our test suite:This test simply exercises the ability to update all documents via the SQLAlchemy ORM:
Such syntax is clearly documented as correct in the SQLAlchemy Docs: http://docs.sqlalchemy.org/en/rel_1_1/orm/query.html#sqlalchemy.orm.query.Query.update
I would be glad to help work through this issue - but might need some help following what
compiler#rewrite_update
is trying to accomplish.