i add python as data source in redash with no error
but when i wrote code there is a problem in importing python library
this is my code
def fun():
import mysql.connector
mydb = mysql.connector.connect(
host=“localhost”,
user=“root”,
passwd=“123speakol”,
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])
fun()
this get an error says:
Error running query: <type ‘exceptions.AttributeError’> ‘module’ object has no attribute 'connector’ @kyoshidajp@arikfr
@kyoshidajp i activate python to 2.7 using command “conda install python =2.7”
and reopen redash but the problem is still same
“module object has no attribute connector”
i activate python to 2.7 using command “conda install python=2.7”
and reopen redash but the problem is still same
“module object has no attribute connector " @kyoshidajp
it gives me error
Error running query:<type ‘exceptions.SyntaxError’> Line 3: “file” is an invalid attribute name because it starts with “_” @kyoshidajp