You are viewing a single comment's thread from:

RE: Using HiveSQL with Python on Mac

in LeoFinance4 years ago

One of the ways is to use csv module. I just added the following lines of code at the bottom of the script above, and the query results were saved as csv file on my desktop.

import csv
import os

fields = ['delegator', 'delegatee', 'vesting_shares', 'timestamp']
filepath = os.getcwd() + '/Desktop/' + 'delegation.csv'

with open(filepath, 'w') as f:
    write = csv.writer(f)
    write.writerow(fields)
    write.writerows(result)
Sort:  

Great one!
Thanks a lot!