2
cur = con.cursor()
for i in sample:
    cur.execute("select `count(*)`,cricking_duels_ratings,cast(`sysdate()` as CHAR) from {}".format(i))
    res = cur.fetchall()
    for row in res:
        print(row)
    ob = s3.Object(BUCKET_NAME, '/testing.csv')
    ob.put(Body=row)
    print("done")

when I try the above, i'm getting following error

'invalid type of parameter body..type: , valid types: , , file-like object'

any suggestions please..

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

1 Answers1

0

It is normally easier to create a local file, then use upload_file() to copy the file to S3. This also makes it easier to debug, since you can view the content of the local file to ensure that it was correctly converted to CSV.

I suspect your problem has to do with converting the row into a string containing comma-separated values. See: How to Iterate through cur.fetchall() in Python

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470