Currently i am writing query in python which export data from oracle dbo to .csv file. I am not sure how to write headers within file.
try:connection = cx_Oracle.connect('user','pass','tns_name')cursor = connection.cursor()print "connected"try:query = """select * from """ .format(line_name)tmp = cursor.execute(query)results = tmp.fetchall()except:passexcept:print IOErrorfilename='{0}.csv'.format(line_name)
csv_file = open(filename,'wb')if results:myFile = csv.writer(csv_file)myFile.writerows(results)
else:print "null"
csv_file.close()