How can i do the following in 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
How can i do the following in 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
As JayDeBeApi implements the DB-API, check PEP 249's .description attribute. This should work:
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