def getcolumns(tbname):
#dgkj 为数据库名称
sql = "select COLUMN_NAME from information_schema.COLUMNS where TABLE_SCHEMA='dgkj' and table_name = '{}'".format(tbname)
conn = getconn()
cur = conn.cursor()
cur.execute(sql)
lsfld = [tfld[0] for tfld in cur.fetchall()]
cur.close()
conn.close()
return lsfld
网友评论