-
Notifications
You must be signed in to change notification settings - Fork 63
feat: Reworked MutateRows to use the data client #1290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3_staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -153,15 +153,16 @@ def _set_cell(self, column_family_id, column, value, timestamp=None, state=None) | |||||||||||||||||
| integer (8 bytes). | ||||||||||||||||||
|
|
||||||||||||||||||
| :type timestamp: :class:`datetime.datetime` | ||||||||||||||||||
| :param timestamp: (Optional) The timestamp of the operation. | ||||||||||||||||||
| :param timestamp: (Optional) The timestamp of the operation. If a | ||||||||||||||||||
| timestamp is not provided, the current system time | ||||||||||||||||||
| will be used. | ||||||||||||||||||
|
|
||||||||||||||||||
| :type state: bool | ||||||||||||||||||
| :param state: (Optional) The state that is passed along to | ||||||||||||||||||
| :meth:`_get_mutations`. | ||||||||||||||||||
| """ | ||||||||||||||||||
| if timestamp is None: | ||||||||||||||||||
| # Use current Bigtable server time. | ||||||||||||||||||
| timestamp_micros = mutations._SERVER_SIDE_TIMESTAMP | ||||||||||||||||||
| if timestamp is None or timestamp == mutations._SERVER_SIDE_TIMESTAMP: | ||||||||||||||||||
| timestamp_micros = timestamp | ||||||||||||||||||
|
Comment on lines
+164
to
+165
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for handling the
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of agree with this, it's easier to skim. But I also think the current code is totally fine
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another way to improve readability would just be to add a comment: |
||||||||||||||||||
| else: | ||||||||||||||||||
| timestamp_micros = _microseconds_from_datetime(timestamp) | ||||||||||||||||||
| # Truncate to millisecond granularity. | ||||||||||||||||||
|
|
@@ -351,7 +352,9 @@ def set_cell(self, column_family_id, column, value, timestamp=None): | |||||||||||||||||
| integer (8 bytes). | ||||||||||||||||||
|
|
||||||||||||||||||
| :type timestamp: :class:`datetime.datetime` | ||||||||||||||||||
| :param timestamp: (Optional) The timestamp of the operation. | ||||||||||||||||||
| :param timestamp: (Optional) The timestamp of the operation. If a | ||||||||||||||||||
| timestamp is not provided, the current system time | ||||||||||||||||||
| will be used. | ||||||||||||||||||
| """ | ||||||||||||||||||
| self._set_cell(column_family_id, column, value, timestamp=timestamp, state=None) | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -651,7 +654,9 @@ def set_cell(self, column_family_id, column, value, timestamp=None, state=True): | |||||||||||||||||
| integer (8 bytes). | ||||||||||||||||||
|
|
||||||||||||||||||
| :type timestamp: :class:`datetime.datetime` | ||||||||||||||||||
| :param timestamp: (Optional) The timestamp of the operation. | ||||||||||||||||||
| :param timestamp: (Optional) The timestamp of the operation. If a | ||||||||||||||||||
| timestamp is not provided, the current system time | ||||||||||||||||||
| will be used. | ||||||||||||||||||
|
|
||||||||||||||||||
| :type state: bool | ||||||||||||||||||
| :param state: (Optional) The state that the mutation should be | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of polluting this file like this.
I mentioned in another comment that we should be able to get the information we need by parsing the exception group, which means we wouldn't need to do this
But even if we ignore that thread, I'd say it could be cleaner to just copy these three lines building the operation directly in the shim, instead of adding this helper. That way we're polluting the shim codebase, instead of the data client
What do you think?