This example is a Python script that generates a source table from an Oracle database.
4 oracle = cx_Oracle.Connection(sys.argv[1]).cursor()
8 for row
in oracle.execute(
"""
22 r.id = s.report_id AND
23 s.id = i.station_id AND
24 LOWER(r.name) NOT IN ('synop', 'temp', 'metar')
28 s =
" [%d]={lat=%d,lon=%d,rep='%s'," % (row[0],row[1],row[2],row[3])
30 if row[4]: s +=
"B01019='%s'," % (row[4].replace(
"'",
"\\'"))
36 for row
in oracle.execute(
"""
56 s =
" [%d]={unit='%s',bcode='%s',tr=%d,p1=%d,p2=%d," % (row[0],row[1],row[2],int(row[3]),int(row[4]),int(row[5]))
58 if (
not math.isnan(row[6])): s +=
"lt1=%d," % (int(row[6]),)
59 if (
not math.isnan(row[7])): s +=
"l1=%d," % (int(row[7]),)
60 if (
not math.isnan(row[8])): s +=
"lt2=%d," % (int(row[8]),)
61 if (
not math.isnan(row[9])): s +=
"l2=%d," % (int(row[9]),)