Ich arbeite an einem a-Handler für das Python-Logging-Modul. Das protokolliert im Wesentlichen zu einer Oracle-Datenbank.Spalteninformationen in cx_oracle erhalten, wenn die Tabelle leer ist?
Ich verwende cx_oracle, und etwas, das ich nicht weiß, wie man die Spaltenwerte erhält, wenn die Tabelle leer ist.
cursor.execute('select * from FOO')
for row in cursor:
# this is never executed because cursor has no rows
print '%s\n' % row.description
# This prints none
row = cursor.fetchone()
print str(row)
row = cursor.fetchvars
# prints useful info
for each in row:
print each
Die Ausgabe lautet:
None
<cx_Oracle.DATETIME with value [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]>
<cx_Oracle.STRING with value [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]>
Jetzt im var Daten suchen i die Datentypen sehen können, und ihre Größen (Anzahl nones?), Aber das ist der Spaltenname fehlt.
Wie kann ich darüber gehen?