You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Find a better name for Row.commit_modifications() or fold the behavior into #1548
The name modifications is intended to map to the RPC method name ReadModifyWriteRow but the word modification is a synonym of mutation, so this method is poorly named. The method actually sends changes that
increment an int (stored in BT as 8 bytes)
append bytes to a cell value
so we should either
Fold it into Row.commit() as commit(append_only=True)
Rename it to something like Row.commit_cell_updates (or a better name than that)
I think the best way forward is to actually create Row(..., append=True) and then make it so that in the append case, only append_cell_value and increment_cell_value will work.
This way Row.commit() does have to worry about sending up to 3 API requests to the RPC methods MutateRow (no filter), CheckAndMutateRow (filter) and ReadModifyWriteRow (append).
No issues with complexity, just worried that people would be confused. Here's some code snippets for how things work right now
>>>row1=table.row(b'row-key')
>>>row2=table.row(b'row-key', filter_=filter_)
>>>>>>row1.set_cell(u'fam', b'col', b'val')
>>>row2.set_cell(u'fam', b'col', b'val')
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"gcloud/bigtable/row.py", line166, inset_cellself._get_mutations(state).append(mutation_pb)
File"gcloud/bigtable/row.py", line97, in_get_mutationsraiseValueError('A filter is set on the current row, but no 'ValueError: Afilterissetonthecurrentrow, butnostategivenforthemutation>>>>>># Use state>>>row1.set_cell(u'fam', b'col', b'val', state=True)
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"gcloud/bigtable/row.py", line166, inset_cellself._get_mutations(state).append(mutation_pb)
File"gcloud/bigtable/row.py", line102, in_get_mutationsraiseValueError('No filter was set on the current row, but a 'ValueError: Nofilterwassetonthecurrentrow, butastatewasgivenforthemutation>>>row2.set_cell(u'fam', b'col', b'val', state=True)
>>>>>># state also an argument in delete(), delete_cell(), delete_cells()>>>>>>row1.append_cell_value(u'fam', b'col', b'extra-bytes')
>>>row2.append_cell_value(u'fam', b'col', b'extra-bytes')
>>>>>>row1.increment_cell_value(u'fam', b'col', 123)
>>>row2.increment_cell_value(u'fam', b'col', 123)
Activity
dhermes commentedon Feb 29, 2016
@jonparrott @jgeewax @tseaver I'd love to have you all chime in.
theacodes commentedon Feb 29, 2016
I like the first option, but unsure about complexity/edge cases.
For option two, would
commit_appendbe a better name?jgeewax commentedon Feb 29, 2016
I like the first also.
commit()does all commits,commit(append_only=True)does just the appending commits. Seems super clear to me.tseaver commentedon Feb 29, 2016
What does the user expect the state-of-the-world to be after
commit(append_only=True), assuming there were any pending non-append modifications?dhermes commentedon Feb 29, 2016
I think the best way forward is to actually create
Row(..., append=True)and then make it so that in the append case, onlyappend_cell_valueandincrement_cell_valuewill work.This way
Row.commit()does have to worry about sending up to 3 API requests to the RPC methodsMutateRow(no filter),CheckAndMutateRow(filter) andReadModifyWriteRow(append).No issues with complexity, just worried that people would be confused. Here's some code snippets for how things work right now
dhermes commentedon Feb 29, 2016
@tseaver Having a hard time answering your question. Can you give a scenario of what you have in mind?
tseaver commentedon Feb 29, 2016
If
commit()doesn't take theappend_onlyargument (which I thought was the option being preferred), then my question is moot.That seems pretty natural: the user can't get the row into a state where uncommitted changes remain after a call to
commit().dhermes commentedon Feb 29, 2016
Yup. Will implement and send out for PR.
Moving Bigtable Row.commit_modifications() into commit().
chore: resolve docstring issue where oneof reference is missing (#1548)
chore: cleanup owlbot and release please files (#1548)
feat(experimental): Implement `__init__` method for _AsyncReadObjectS…
docs: add samples from spanner/cloud-client (#117)
fix: pandas.cut returns labels index for numeric breaks when labels=F…