问题
I am trying to retrieve data from database and save it into excel/csv file, There is column containing blob data , i have to save that data in .zip format in a local folder with name of that file (i.e., the name of the file containing that blob data, which is already a column value in my database). I have written the below code to store all the non blob column in my excel but i am not able to fetch that blob column from db and save it into the folder. Please suggest.
import os
import cx_Oracle
import csv
SQL="SELECT * FROM SOME_TABLE"
filename="S:\Output.csv"
FILE=open(filename,"w");
output=csv.writer(FILE, dialect='excel')
connection = cx_Oracle.connect('userid/password@99.999.9.99:PORT/SID')
cursor = connection.cursor()
cursor.execute(SQL)
for row in cursor:
output.writerow(row)
cursor.close()
connection.close()
FILE.close()
Thanks, Aditya Singh
来源:https://stackoverflow.com/questions/58841272/fetching-file-from-db-and-save-it-into-local-folder-using-python