This view is running fine on plain pyton/Django/mysql on Windows
I'm porting this to run over jython/Django/mysql and it gives error -
Exception received is : error setting index [10] [SQLCode: 0]
Parameter index out of range (10 > number of parameters, which is 0). [SQLCode: 0],
[SQLState: S1009]
The Query is -
cursor.execute("select value from table_name
where value_till_dt >= str_to_date('%s,%s,%s,%s,%s', '%%m,%%d,%%Y,%%H,%%i')
AND value_till_dt <= str_to_date('%s,%s,%s,%s,%s', '%%m,%%d,%%Y,%%H,%%i')
and granularity='5'
ORDER BY value_till_dt",
[int(tempStart.month),int(tempStart.day), int(tempStart.year), int(tempStart.hour), int(tempStart.minute),
int(tempEnd.month), int(tempEnd.day), int(tempEnd.year), int(tempEnd.hour), int(tempEnd.minute)])
As you see there are 10 parameters being passed to this query. Does the error mean that the query is not getting the parameters ?
I have printed out the parameters just before the execution and they are showing as being passed correctly -
1 - Start Parameters being passed are : 1 11 2010 10 0
2 - End Parameters being passed are : 1 11 2010 10 5
The only different in the second environment is that there is no data available for this date range. But the error does not seem to be related to data.
Any thoughts are appreciated.