Uh oh!
There was an error while loading. Please reload this page.
Implement MergeOption as an option - #4851
Conversation
77795e1 to
2efc83fCompare2efc83f to
16c9588Compare16c9588 to
c5e2ed4Comparec5e2ed4 to
03dc67fCompare08f0ee5 to
e0d9b28Compare| return document_id | ||
| def get_field_paths(update_data): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| fields=encode_dict(actual_data), | ||
| ), | ||
| ) | ||
| if option is not None: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| _BAD_OPTION_ERR = ( | ||
| 'Exactly one of ``create_if_missing``, ``last_update_time`` ' | ||
| 'and ``exists`` must be provided.') | ||
| 'Exactly one of ``last_update_time`` or ``exists`` must be provided.') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| elif not self._create_if_missing: | ||
| current_doc = types.Precondition(exists=True) | ||
| write_pb.current_document.CopyFrom(current_doc) | ||
| mask = common_pb2.DocumentMask(field_paths=sorted(field_paths)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
7eec589 to
1af5b12Comparefa1e5d0 to
53159e9Compare2ea0832 to
93f0441Compare93f0441 to
138111bCompare
schmidt-sebastian
left a comment
There was a problem hiding this comment.
This looks pretty close from a functional perspective. Some comments (mostly small nits) remaining.
Can you send this over to someone that understands Python after you resolved these last comments? Thanks!
| for sub_path in sub_transform_paths: | ||
| field_path = FieldPath.from_string(field_name) | ||
| field_path.parts = field_path.parts + sub_path.parts | ||
| transform_paths.extend([field_path]) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| if split_on_dots: | ||
| transform_paths.append(FieldPath(*field_name.split("."))) | ||
| else: | ||
| transform_paths.append(FieldPath.from_string(field_name)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| else: | ||
| return field_paths, document_data | ||
| field_paths.append(FieldPath(field_name)) | ||
| if not transform_paths: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| _BAD_OPTION_ERR = ( | ||
| 'Exactly one of ``create_if_missing``, ``last_update_time`` ' | ||
| 'and ``exists`` must be provided.') | ||
| 'Exactly one of ``last_update_time``, ``exists`` ' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| assert snapshot.to_dict() is None | ||
| # 1. Use ``set()`` to create the document (using an option). | ||
| # 1. Use ``create()`` to create the document (using an option). |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| data2 = {'1a.ab': '4d', '6f.7g': '9h'} | ||
| option2 = client.write_option(create_if_missing=True) | ||
| option2 = client.write_option(exists=True) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| snapshot = document.get() | ||
| assert not snapshot.exists | ||
| # 1. Use ``set()`` to create the document (using an option). |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| try: | ||
| self.run_write_test(test_proto, desc) | ||
| except (AssertionError, Exception) as error: | ||
| count += 1 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| data = convert_data(json.loads(tp.json_data)) | ||
| # TODO: call doc.set. | ||
| if tp.HasField("option"): | ||
| option = True |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
10d612b to
b166f06Comparemikedh
commented
Oct 16, 2018
Hey, this finally made it to Pypi in a release, and unfortunately broke some things for me. This PR removes It looks like the migration here is (?): Given the arg ordering, an ugly backwards compatibility patch could be: |
tseaver
commented
Oct 16, 2018
@mikedh The Firestore API team explicitly asked us to remove @schmidt-sebastian Can you comment here? |
samtstern
commented
Oct 16, 2018
That's the correct API change, just looks like it took a bit longer for it to land in Python than the other SDKs and we didn't time the doc updates with the release. I'll get the docs updated. |
samtstern
commented
Oct 16, 2018
Fixing here: |
mikedh
commented
Oct 16, 2018
Thanks! The API change seems like an improvement. |
Remove `CreateIfMissing` option Closes#4111.
Should close #4111
The first and second commits is #4654.