0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GlueにS3ファイルを読み込みと書き込み

Posted at

https://qiita.com/nemutas/items/c3346a866fa7fe6f7d60
フォルダに保存したcsvデータを、S3バケットにアップロードする

import boto3
filepath = '/tmp/data.csv'
baket_name = 'release-comics'
savepath = 'data.csv'

s3 = boto3.resource('s3')
s3.meta.client.upload_file(filepath, baket_name, savepath)


https://qiita.com/asunaro/items/99472b492af387d97b70
import pandas as pd
import boto3
from io import StringIO

s3 = boto3.client('s3')
obj = s3.get_object(Bucket='バケット名', Key='ファイル名.csv')
body = obj['Body']
csv_string = body.read().decode('utf-8')
df = pd.read_csv(StringIO(csv_string))


https://qiita.com/skokado/items/57d8f32bb88f4629f2d6
s3 = boto3.client('s3', region_name = 'ap-northeast-1')
response = s3.put_object(
Body = io.BufferedReader(uploaded_file).read(),
Bucket = s3_bucket,
Key = f'{s3_dir}/{uploaded_file.filename}'
)


https://qiita.com/smiler5617/items/2edaaf9f6ffdef85a809
response = s3.list_objects_v2(Bucket=bucket, Prefix=prefix)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?