python - Fetch and write CLOB type values from oracle to a file -
i new python, , have questions, , please:
i trying processing on data in python. need connect db , data, 300,000 rows of type clob. column in db has content (text), urls , html tags, thats how have set up, cant change that. project (phase one) go through column in table in db , extract urls, using beautifulsoup url extraction, have part done. getting data (clob) out of db , storing file (i guess doesn't have csv, 1 decided try csv) thats having problems with.
how row of data after fetching code, notice double quotes, in actual db there 1 double quote only:
()
here code:
import csv import cx_oracle sql = """select target_values temp_ip_url_backup"""; filename="results.csv" results=csv.writer(file, dialect='excel') connection = cx_oracle.connect('db connection stuff') cursor = connection.cursor() cursor.execute(sql) rows = cursor.fetchall() row in rows: results.writerow(row) cursor.close() connection.close() file.close()
first question: why file coming doubled double quotes?
second question: understand result coming tuples, how convert string , store in file?
your answers highly appreciated. thank you.
Comments
Post a Comment