1.我碰到的问题:
两个SQL语句:
sql1="select table_name from information_schema.tables where table_schema=%s"
sql2="SELECT * FROM %s" 或sql2="SELECT * FROM (%s)"
变量:
dbname="testone"
tablename="student"
执行语句:
dbcursor1.execute(sql1,(dbname,))
dbcursor1.execute(sql2,(tablename,))
结果:
dbcursor1能够正常执行并显示结果,而dbcursor2报错,不能执行。raise ValueError("Could not process parameters")
求助:像sql2一样,要把变量传给表名,要怎么写才有用?