Columns
The available columns for any given table are fetched from a system table called "sys_tablecolumns".
A specific table name is provided in the WHERE criteria to restrict the table from which the column information is fetched:
import cdata.db2 as mod
conn = mod.connect("Server=10.0.1.2;Port=50000;User=admin;Password=admin;Database=test")
cur = conn.cursor()
cmd = "SELECT * FROM sys_tablecolumns WHERE TableName = '\"Sample\".\"DB2INST1\".Books'"
cur.execute(cmd)
rs = cur.fetchall()
for row in rs:
print(row)