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
withopen('s3://smart-open-py37-benchmark-results/test.txt', 'wb', transport_params={'client': client}) as fout:
168
+
bytes_written = fout.write(b'hello world!')
169
+
print(bytes_written)
170
+
171
+
# perform a single-part upload to S3 (saves billable API requests, and allows seek() before upload)
172
+
withopen('s3://smart-open-py37-benchmark-results/test.txt', 'wb', transport_params={'multipart_upload': False}) as fout:
173
+
bytes_written = fout.write(b'hello world!')
174
+
print(bytes_written)
175
+
# now with tempfile.TemporaryFile instead of the default io.BytesIO (to reduce memory footprint)
176
+
import tempfile
177
+
with tempfile.TemporaryFile() as tmp, open('s3://smart-open-py37-benchmark-results/test.txt', 'wb', transport_params={'multipart_upload': False, 'writebuffer': tmp}) as fout:
178
+
bytes_written = fout.write(b'hello world!')
179
+
print(bytes_written)
168
180
169
181
# stream from HDFS
170
182
for line inopen('hdfs://user/hadoop/my_file.txt', encoding='utf8'):
0 commit comments