Opened 8 years ago

Last modified 8 years ago

#28274 closed Bug

Django OperationalError near "?": Syntax error — at Version 1

Reported by: Adama Camara Owned by: nobody
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords: SQLite pytest
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adama Camara)

I am running some test, but I keep getting this error:

self = <django.db.backends.sqlite3.base.SQLiteCursorWrapper object at 0x7f619aa32d38>
query = ' SELECT cust.id, cust.name, inv.currency_id, SUM(inv.total)\n FROM\n v3_customer as cust\n ... and inv.invoice_date < ?\n GROUP BY cust.id, inv.currency_id\n ORDER BY cust.id, inv.currency_id'
params = [(1, 2, 3, 4), '2016-12-08']

def execute(self, query, params=None):

if params is None:

return Database.Cursor.execute(self, query)

query = self.convert_query(query)

return Database.Cursor.execute(self, query, params)

E django.db.utils.OperationalError: near "?": syntax error

../../../environments/tracerenv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py:337: OperationalError

When looking at the SQL statements and trying to find the "?" symbol it does not appear:
WHERE

cust.id IN %s
and inv.type = 'i'
and inv.invoice_date < %s ----> "comment: It is here the "?" should have appeared"

GROUP BY cust.id, inv.currency_id
ORDER BY cust.id, inv.currency_id

Could there be some incompatibilities between Postgre and SQLite?

Change History (1)

comment:1 by Adama Camara, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top