@@ -34,14 +34,49 @@ def __init__(self, *args, **kwargs):
34
34
35
35
super ().__init__ (* args , ** kwargs )
36
36
37
+ def uri (self ) -> bigframes .series .Series :
38
+ """URIs of the Blob.
39
+
40
+ .. note::
41
+ BigFrames Blob is still under experiments. It may not work and subject to change in the future.
42
+
43
+ Returns:
44
+ BigFrames Series: URIs as string."""
45
+ s = bigframes .series .Series (self ._block )
46
+
47
+ return s .struct .field ("uri" )
48
+
49
+ def authorizer (self ) -> bigframes .series .Series :
50
+ """Authorizers of the Blob.
51
+
52
+ .. note::
53
+ BigFrames Blob is still under experiments. It may not work and subject to change in the future.
54
+
55
+ Returns:
56
+ BigFrames Series: Autorithers(connection) as string."""
57
+ s = bigframes .series .Series (self ._block )
58
+
59
+ return s .struct .field ("authorizer" )
60
+
61
+ def version (self ) -> bigframes .series .Series :
62
+ """Versions of the Blob.
63
+
64
+ .. note::
65
+ BigFrames Blob is still under experiments. It may not work and subject to change in the future.
66
+
67
+ Returns:
68
+ BigFrames Series: Version as string."""
69
+ # version must be retrived after fetching metadata
70
+ return self ._apply_unary_op (ops .obj_fetch_metadata_op ).struct .field ("version" )
71
+
37
72
def metadata (self ) -> bigframes .series .Series :
38
73
"""Retrive the metadata of the Blob.
39
74
40
75
.. note::
41
76
BigFrames Blob is still under experiments. It may not work and subject to change in the future.
42
77
43
78
Returns:
44
- JSON: metadata of the Blob. Contains fields: content_type, md5_hash, size and updated(time)."""
79
+ BigFrames Series: JSON metadata of the Blob. Contains fields: content_type, md5_hash, size and updated(time)."""
45
80
details_json = self ._apply_unary_op (ops .obj_fetch_metadata_op ).struct .field (
46
81
"details"
47
82
)
@@ -56,12 +91,60 @@ def content_type(self) -> bigframes.series.Series:
56
91
BigFrames Blob is still under experiments. It may not work and subject to change in the future.
57
92
58
93
Returns:
59
- BigFrames Series: json-string of the content type."""
60
- metadata = self .metadata ()
94
+ BigFrames Series: string of the content type."""
95
+ return (
96
+ self .metadata ()
97
+ ._apply_unary_op (ops .JSONValue (json_path = "$.content_type" ))
98
+ .rename ("content_type" )
99
+ )
100
+
101
+ def md5_hash (self ) -> bigframes .series .Series :
102
+ """Retrive the md5 hash of the Blob.
103
+
104
+ .. note::
105
+ BigFrames Blob is still under experiments. It may not work and subject to change in the future.
106
+
107
+ Returns:
108
+ BigFrames Series: string of the md5 hash."""
109
+ return (
110
+ self .metadata ()
111
+ ._apply_unary_op (ops .JSONValue (json_path = "$.md5_hash" ))
112
+ .rename ("md5_hash" )
113
+ )
114
+
115
+ def size (self ) -> bigframes .series .Series :
116
+ """Retrive the file size of the Blob.
117
+
118
+ .. note::
119
+ BigFrames Blob is still under experiments. It may not work and subject to change in the future.
120
+
121
+ Returns:
122
+ BigFrames Series: file size in bytes."""
123
+ return (
124
+ self .metadata ()
125
+ ._apply_unary_op (ops .JSONValue (json_path = "$.size" ))
126
+ .rename ("size" )
127
+ .astype ("Int64" )
128
+ )
129
+
130
+ def updated (self ) -> bigframes .series .Series :
131
+ """Retrive the updated time of the Blob.
132
+
133
+ .. note::
134
+ BigFrames Blob is still under experiments. It may not work and subject to change in the future.
135
+
136
+ Returns:
137
+ BigFrames Series: updated time as UTC datetime."""
138
+ import bigframes .pandas as bpd
139
+
140
+ updated = (
141
+ self .metadata ()
142
+ ._apply_unary_op (ops .JSONValue (json_path = "$.updated" ))
143
+ .rename ("updated" )
144
+ .astype ("Int64" )
145
+ )
61
146
62
- return metadata ._apply_unary_op (
63
- ops .JSONValue (json_path = "$.content_type" )
64
- ).rename ("content_type" )
147
+ return bpd .to_datetime (updated , unit = "us" , utc = True )
65
148
66
149
def display (self , n : int = 3 , * , content_type : str = "" ):
67
150
"""Display the blob content in the IPython Notebook environment. Only works for image type now.
0 commit comments