Answer the question
In order to leave comments, you need to log in
How to save unloading from Oracle in CSV?
Hello.
I want to upload information from an Oracle object to a CSV file.
trying to do so
csv_file=open("C:\\DataBases\\csv\\%s_%s.csv" % (FILE_NAME, TABLE_NAME), "a")
# wr.writerow(mylist)
for row in cursor:
result_inside={}
for col, val in zip(col_names, row):
result_inside[col] = val
count_rows+=1
result_select_from_oracle.append(result_inside)
csv_file.csv.writer(result_inside, quoting=csv.QUOTE_ALL)
print("Обнаружено сторок: ",count_rows)
file.close();
csv_file.close();
csv_file.csv.writer(result_inside, quoting=csv.QUOTE_ALL)
AttributeError: '_io.TextIOWrapper' object has no attribute 'csv'
Answer the question
In order to leave comments, you need to log in
the csv_file object doesn't really have a csv attribute :-)
writer= csv.writer(csv_file, delimiter=';')
for line in data:
writer.writerow(result_inside)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question