Dec-07-2022, 06:46 AM
Hi Team,
with the below code I am extracting sql table data into CSV File with delimiter '|'
in SQL Table,in some fields ['Market Price',"Spread"] it has null Records. So for these values I want to
write values 0.0 as float(data type).
writer.writerows(row)
with the below code I am extracting sql table data into CSV File with delimiter '|'
in SQL Table,in some fields ['Market Price',"Spread"] it has null Records. So for these values I want to
write values 0.0 as float(data type).
writer.writerows(row)
qry = "select * from Trading_data" cursor.execute(qry) data = cursor.fetchall() With open("E:\\backup\\output.csv","w","newline="") as outfile writer = csv.writer(outfile,quoting = csv.QUOTE_NONNUMERIC) writer.writerows(col[0] for col in cursor.description) While True: rows = cursor.fetchmany(10000) if len(rows) ==0: print("no records found") break else: for row in rows: writer.writerows(row)