You are viewing a single comment's thread from:

RE: Using HiveSQL with Python on Mac

in LeoFinance3 months ago

Nice one .... what about export cv?


What is export cv?

Oh ... typo, sorry, I mean CSV ... to export the data in csv file :)

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)

Great one!
Thanks a lot!