2
我使用MySQL Connector/Python从我的iPython笔记本运行MySQL。如何使用MySQL连接器/ Python创建临时表?
我想知道,我可以用这种方式创建临时表吗?
documentation对临时表没有任何说明,并且看起来您在使用它之前必须先定义一个表。
我想沿着这些路线的东西:
cnx = mysql.connector.connect(user='me',
password='something',
host='somewhere',
port='3306',
database='some_db')
query = "CREATE TEMPORARY TABLE IF NOT EXISTS " +\
"my_temp_table " +\
"AS " +\
"SELECT a_col" +\
"FROM
. . .
;"
当我尝试这从IPython的,它运行并没有给出回应,但在数据库中的临时表没有显示出了。
感谢您的帮助提前。