我在redash中添加Python作为数据源, 但当进口'MySQL.connector'模块I出错:
我看了这篇文章: http://kzkohashi.hatenablog.com/entry/2017/12/09/224516
def read_sql():
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="******",database="testing")
mycursor = mydb.cursor()
mycursor.execute("select hour,sum(temperature) as temperature ,sum(wind_speed) as wind_speed from weatherdaat group by hour")
myresult = mycursor.fetchall()
for x in myresult:
print(x[0],x[1],x[2])
read_sql()
我得到这个错误
Error running query: <type 'exceptions.AttributeError'> 'module' object has no attribute 'connector'
装置好像坏了。在
试试这个:
那么这个:
^{pr2}$然后:
相关问题 更多 >
编程相关推荐