Pracuję nad modułem obsługi modułu rejestrującego Pythona. To zasadniczo loguje się do bazy danych Oracle.Uzyskiwanie informacji o kolumnie w cx_oracle, gdy tabela jest pusta?
Używam cx_oracle, a coś, czego nie wiem, jak uzyskać, to wartości kolumn, gdy tabela jest pusta.
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
Wyjście jest:
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]>
Teraz patrząc na dane var widzę typy danych, a ich rozmiary (liczyć Nones?), Ale to brakuje nazwę kolumny.
Jak mogę to zrobić?