Hi guys, i´m performing a bunch of raw querys to a sqlite database(the one who comes with the django). I tested the query in the data base browser and it works like a charm but when i tested it in views give me the “django.db.utils.OperationalError: near “?”: syntax error”
'> with connection.cursor() as cursor:
> cursor.execute(
> "select Count(point.id), areaTable.description " \
> "from indoorsite_point point " \
> "INNER JOIN indoorsite_tag as tag " \
> "ON point.tag_id = tag.id" \
> "INNER JOIN indoorsite_area as areaTable " \
> "ON areaTable.id = point.area_id " \
> "WHERE point.tag_id IN %s AND point.date BETWEEN %s AND %s " \
> "Group By point.area_id", [np.array(data["users"]), date, endDate]
> )
> row = cursor.fetchall()
> stats.append(row)'
I tried pass the array hardcoded in the string like " WHERE point.tag_id IN (1,2,3)" and give me the following error “django.db.utils.ProgrammingError: Cannot operate on a closed cursor.”
Any suggestion?