我如何在 jaydebeapi 中执行以下操作?
#In Java
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();
String columnName = rsmd.getColumnName(0) ## basically i am interested with this part
我如何在 jaydebeapi 中执行以下操作?
#In Java
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();
String columnName = rsmd.getColumnName(0) ## basically i am interested with this part
由于 JayDeBeApi 实现了 DB-API,请检查PEP 249 的 .description 属性。这应该有效:
import jaydebeapi
conn = jaydebeapi.connect(...)
curs = conn.cursor()
curs.execute('SELECT a, b, c FROM TABLE2')
column_name = curs.description[0][0]
assert column_name == 'a', column_name