Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 sure I understand this. For files that we migrated from S3 to GCS,
custom_time
will be set and will be the same value type asupdated
(e.g. seconds since epoch, Python datetime in UTC, etc). Is that right? What is that value type?For files that were not migrated from S3, what does
custom_time
get set to? Does it exist as an attribute ofblob
object?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.
migrated files will have a custom time that matches the s3 upload time and an upload time in the last week, and yes they will have the same type, though i don't know what that is.
when custom time isn't present the attribute will be None, which is false-y.
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.
The type of both
blob.custom_time
andblob.updated
isdatetime.datetime | None
. The latter will always be set in this case, since it can only beNone
for objects that haven't been uploaded yet.For objects directly uploaded to GCS,
blob.updated
is the time the upload finished, andblob.custom_time
isNone
.For objects migrated from S3,
blob.updated
is the time the object was migrated, andblob.custom_time
is the original upload time.In both cases,
blob.custom_time or blob.updated
evaluates to the original upload time, which is what we want.I added type annotations to
ObjectMetadata
, and the GCS Python client also has type hints, so VS Code shows me type information for everything while typing. I also tested this by manually creating a GCS client and retrieving blobs with an without custom time metadata.