sql - python - does cx_Oracle allow you to force all columns to be cx_Oracle.STRING? -
sql - python - does cx_Oracle allow you to force all columns to be cx_Oracle.STRING? -
this little snippet of python code (not entire thing) write results file. because table i'm querying has timestamp(6) local time zone datatypes, file storing values in different format ie '2000-5-15 0.59.8.843679000' instead of '15-may-00 10.59.08.843679000 am'. there way forcefulness write file if datatype varchar (ie cx_oracle.string or otherwise file has same content querying through client tool)?
db = cx_oracle.connect(..<my connect string>.) cursor = db.cursor() file = open('c:/blah.csv', "w") r = cursor.execute(<my sql>) row in cursor: writer.writerow(row)
could utilize to_char within query? way forced string type.
r = cursor.execute("select to_char( thetime, 'dd-mon-rr hh24.mi.ssxff' ) my_table")
python sql database oracle scripting
Comments
Post a Comment